On Sun, 2006-01-15 at 23:11 +0000, Jeremy Nixon wrote: > Perrin Harkins <[EMAIL PROTECTED]> wrote: > > > The prepare_cached() method he's using will check the statement handle > > and prepare it again on the new connection if necessary. > > Not with Apache::DBI, though. The reconnect happens underneath DBI, and > you end up with the same $dbh, which thinks the prepared statement is > still valid.
Maybe I'm reading it incorrectly, but it looks like prepare_cached will handle this. Look at this line from the sub: 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. This won't work if you cache them yourself, by putting them in globals or something. That's why you should use prepare_cached instead of caching statement handles on your own. - Perrin