On Mon, Apr 19, 2004 at 10:55:35AM +0530, Jason E. Stewart wrote:
> Tim Bunce <[EMAIL PROTECTED]> writes:
> 
> > On Sat, Apr 17, 2004 at 06:34:15PM +0530, Jason E. Stewart wrote:
> > > Hey All,
> > > 
> > > Using DBI 1.41 and DBD::Pg 1.32 with mod_perl 1.29.0.2 and I get a
> > > strange situation.
> > > 
> > > When I'm using a DB handle that ends in an error condtion, the next
> > > time my mod_perl script calls connect_cached() if I check $DBI::err it
> > > is still set to the last error that happend - not any error that
> > > happened during the connect_cached() call - this leads to my connect
> > > script thinking it got an error during the connect call, which isn't
> > > true. 
> > > 
> > > Do I need to be manually cleaning up DBI somehow? Or is this a bug?
> > 
> > Umm, on second thoughts, please post a (small self-contained) script
> > that demonstrates the problem. Thanks.
> 
> Thanks Tim,
> 
> Here's the script:

Ah, okay. Looking at the trace I see what's going on.

The connect_cached() method perhaps ought to explicitly reset the
error state of the $dbh because it's separate to the $dbh error
state and the $dbh method calls it uses don't reset the state implicitly.

The same applies to prepare_cached().

However, I'm not 100% sure I want to do that right now as I'd rather people
only used $DBI::err after the preceding method call indicates an error
(usually by returning false).

But I've made a note to consider thus further.

Tim.

Reply via email to