[CDBI] Prepared statement handle error under mod_perl

Tim Bunce Tim.Bunce at pobox.com
Thu Jan 19 10:41:29 GMT 2006


On Wed, Jan 18, 2006 at 10:44:40PM -0800, Ryan Tate wrote:
> On 1/18/06, Perrin Harkins <perrin at elem.com> wrote:
> >Try disabling MySQL's auto-reconnect feature.
> 
> Thanks for this, it sounds promising. I have it disabled but of course
> I need some hours before I know if it worked ;->
> 
> I may submit a DBD::mysql doc patch -- it works in the \%attrs
> argument to DBI->connect (i.e. {RaiseError => 1, mysql_auto_reconnect
> => 0}) but not in the dsn, which could be made clearer (especially
> since mysql_use_result works this way).
> 
> I also vaguely wonder if DBD::mysql or DBI could handle this whole
> thing more gracefully -- one would think an sth cached by
> prepare_cached would be cleared out on reconnect if the reconnect is
> going to spoil the sth. But that's way beyond the scope of this list.

Yes, auto-reconnect should clear $dbh->{CachedKids}. (That won't deal with
any $sth being used by the application code, but that's a different problem).

But auto-reconnect is (IMHO) a bad idea for all but the most trivial of
applications.

Tim.




More information about the ClassDBI mailing list