Tim Bunce wrote:
On Wed, Jan 25, 2006 at 02:51:14PM -0500, Steven Lembark wrote:
-- Tim Bunce <[EMAIL PROTECTED]>
$dbh->connect_cached( @{ $meta{ $dbh } } );
If the connection has failed then connect_cached() will return a new,
different, $dbh which would be lost with the code above.
To change the $dbh in the application to be this new $dbh you'd need to
use swap_internal_handle(). If I was mad enough to try this I'd probably
do:
$new_dbh = $dbh->clone;
$dbh->swap_internal_handle($new_dbh);
So much for hacking error handlers in my mail editor :-)
Why "mad enough"? The point is that if I have a long
running (months at a time) daemon then it'd be nice
not to have to restart it each time the databas is
restarted: just let HandleError deal with it and keep
on trukin...
Sure, I can certainly understand the motivation. It's just that I
suspect there will be plenty of worms to deal with in this can before
you arrive at a reasonably robust solution.
Tim.
That's what I did with DBIx::HA, which was the reason for my requesting
swap_inner_handle() in the first place. :-)
Very obscure worms still existed as of DBI 1.45. I haven't checked
since, but the problems were extremely hard to reproduce (of course).
H