Hi Tim, 

I added your code (verbatim) immediately before the returned $dbh at the end of
DBD::Oracle::connect, but got results like this for all the test scripts:

t/select.....Can't set DBI::db=HASH(0x1d266c)->{USER}: unrecognised attribute
or invalid value at
/opt/perl/.cpan/build/DBD-Oracle-1.14/blib/lib/DBD/Oracle.pm line 284.
Issuing rollback() for database handle being DESTROY'd without explicit
disconnect().  t/select.....dubious                                                    
     
        Test returned status 2 (wstat 512, 0x200)

Thoughts?

--Eric.

On Mon, Jan 05, 2004 at 10:31:21PM +0000, Tim Bunce wrote:
> 
> Having thought about this some more I think the right fix is for
> DBD::Oracle's connect() method to set the Username, USER, and
> CURRENT_USER attributes to the result of that query.
> 
> So just before the end of the connect sub in Oracle.pm add something
> like this:
> 
>   unless (length $user_only) {
>     $user_only = $dbh->selectrow_array(qq{
>         select sys_context('userenv','current_schema') from dual
>     });
>     $attr->{Username} = $user_only if $attr;
>     $dbh->{Username} = $user_only;
>     # these are temporary for backwards compatibility
>     $dbh->{USER} = $user_only;
>     $dbh->{CURRENT_USER} = $user_only;
>   }
> 
> and then the test script need not be changed.
> 
> (There ought to be a more efficient way of asking OCI for the name
> but I don't know what it is off-hand.)
> 
> Can you try that for me, Eric, and send me a patch?
> Thanks.
> 
> Tim.

Reply via email to