OK Tim. One other note -- after reading through oracle docs, I think you might
want to substitute 'session_user' for 'current_schema' in 'select
sys_context(...)'.  The definition of session_user is "returns the database
user name by which the current user is authenticated" while current_schema is
"returns the name of the default schema being used in the current session".
Maybe it doesn't matter, I'm not an oracle guru by any stretch of the
imagination.

Let me know if you want me to test anything else...

Eric.

On Tue, Jan 06, 2004 at 10:38:45PM +0000, Tim Bunce wrote:
> Ah, I know what that was. It's got to the point where it's
> easier for me to do it than explain it so I'll look after it for you.
> Just make a note to test in the next release.
> 
> Thanks for your help!
> 
> Tim.
> 
> > Tue, Jan 06, 2004 at 05:26:34PM -0500, Eric Lenio wrote:
> > 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