On Tue, May 05, 2015 at 07:42:14AM -0600, J.D. Laub wrote: > I'd like to propose a small enhancement to DBD::Oracle.
> However, when I connect via DBI using an oracle wallet (SEPS) entry, that > information is never > presented. I tracked the inconsistency to > DBD-Oracle-1.74/lib/DBD/Oracle.pm , line 309: > > 309 unless (length $user_only) { > 310 $user_only = $dbh->selectrow_array(q{ > 311 SELECT SYS_CONTEXT('userenv','session_user') FROM > DUAL > 312 })||''; > 313 $dbh_inner->{Username} = $user_only; > 314 # these two are just for backwards compatibility > 315 $dbh_inner->{USER} = $dbh_inner->{CURRENT_USER} = uc > $user_only; > 316 } That 'uc' looks suspicious to me, but that would be a pre-existing issue. > I'm thinking maybe it should save off the existing values for those 3 > attributes, run the query, and > then append the old values onto those resulting from the selectrow_array. > (Technically that would leave > them in the wrong order - with the selectrow_array info ahead of the > connect info - but maybe that's not > important.) The attached patch rather clumsily does that, and has > resolved the problem in my > environment. I'm happy to revise the patch - just tell me where it's > lacking. > unless (length $user_only) { > + # It may be we've already encountered a warning by this point, > + # such as "ORA-28002: the password will expire within %d days". > + # We'll cache it for reinstatement. > + my ($err, $errstr, $state) = > + ($dbh->err, $dbh->errstr, $dbh->state); > $user_only = $dbh->selectrow_array(q{ > SELECT SYS_CONTEXT('userenv','session_user') FROM DUAL > })||''; > + # Now we'll reinstate the earlier warning. We're just > + # appending it, so in the extremeley unlikely case that the > + # selectrow_array we just issued also issued a warning, the > + # 2 warnings will appear out of order. > + $dbh->set_err($err, $errstr, $state) if defined $err; Looks ok to me. Tim.