On Tue, Jan 13, 2004 at 06:04:01PM +1100, Mathew Robertson wrote:
>    Hi folks,
>     
>    I beleive I have found a bug in the implementation of the 'clone()' call.  DBI.pm 
> version 1.40, line 636
>     
>    The code in that area deals with the creation of the 'dbi_connect_closure' 
> capability.  In particular,
>    it copies the current handle attributes into the new handle that is being created.
>     
>    The code specifically crashes when trying to assign attributes 'User' and 
> 'CURRENT_USER' - given that
>    'Username' is already being passed, I suspect that these two attribute names have 
> become deprecated over
>    time.

Yes, kind of - they were never in the DBI spec but did appear in
the first versions of the first driver about 10 years ago :)

>    I'd like be able to suggest a solution (except for putting the assignment inside 
> an eval), except that I
>    dont grok " ->{attrib} " syntax used on the database handle -> I haven't seen 
> that capability before...
>    I figure its some type of " -> " overload, but its got me beat...
>     
>    In any case - I hope this bug report is has sufficient info for you to solve the 
> problem.

It is, thanks (you haven't said what driver you're using, I'll guess
DBD::Oracle, by it's not significant here).

Try these changes:

--- DBI.xs      2004/01/07 17:38:51     11.37
+++ DBI.xs      2004/01/13 13:58:52
@@ -1370,4 +1370,6 @@
                            || strEQ(key,"Statement")
                            || strEQ(key,"Username")
+       /* these are here for backwards histerical raisons */
+       || strEQ(key,"USER") || strEQ(key,"CURRENT_USER")
     ) ) {
        cacheit = 1;

--- DBI.pm      2004/01/08 14:03:46     11.42
+++ DBI.pm      2004/01/13 14:00:52
@@ -634,5 +634,5 @@
            }
            foreach $a (keys %$attr) {
-               $dbh->{$a} = $attr->{$a};
+               eval { $dbh->{$a} = $attr->{$a} } or $@ && warn $@;
            }
        }

Do the DBI.pm one first and check it works (you get a warning and
not a fatal error) and then apply the DBI.xs change and the warning
should go away.

Please let me know how it goes for you.

Tim.

Reply via email to