Re: Possible extension for DBI error handler (fwd)





-- Tim Bunce <Tim.Bunce@xxxxxxxxx>

>> $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...

--
Steven Lembark 85-09 90th Street
Workhorse Computing Woodhaven, NY 11421
lembark@xxxxxxxxxxx 1 888 359 3508
.



Relevant Pages

  • Re: Possible extension for DBI error handler (fwd)
    ... $dbh which would be lost with the code above. ... > So much for hacking error handlers in my mail editor :-) ... > not to have to restart it each time the databas is ...
    (perl.dbi.users)
  • Re: Finding out a DBI connection is broken?
    ... This comes in useful when using persistent connections such as in mod_perl ... scripts. ... See the dbh() method snippet from a singleton class I created ... If I restart the database server, ...
    (comp.lang.perl.misc)