On Sun, 2006-01-15 at 23:35 +0000, Jeremy Nixon wrote: > Perrin Harkins <[EMAIL PROTECTED]> wrote: > > > my $cache = $dbh->FETCH('CachedKids'); > > > > That should return cached handles from the current $dbh, not an old one > > that has been replaced. The statement handles are attached to the > > database handle, so if it gets replaced, all the old ones go away. > > Right, but Apache::DBI doesn't replace the database handle, it just > provides it with a new connection.
No, it completely replaces the handle the Apache::DBI cache, so that you get the new one instead of the dead one when you call DBI->connect(). Take a look at the (short and simple) Apache::DBI code. It's just a hash of connections, and when one gets replaced, the old one is totally gone. If you have some code that is caching $dbh in a global or closure, and not calling Apache::DBI->connect() on every request, it can't replace that, and neither can DBI->connect_cached(). That defeats the auto- reconnect features of both. I recommend not caching $dbh yourself, except maybe in pnotes(), since pnotes() only last until the end of the request. - Perrin