[Jifty-commit] r5045 - in Jifty-DBI/branches/tisql: lib/Jifty/DBI
Jifty commits
jifty-commit at lists.jifty.org
Tue Feb 5 21:19:07 EST 2008
Author: ruz
Date: Tue Feb 5 21:19:07 2008
New Revision: 5045
Modified:
Jifty-DBI/branches/tisql/ (props changed)
Jifty-DBI/branches/tisql/lib/Jifty/DBI/Handle.pm
Log:
r4929 at cubic-pc (orig r4928): sterling | 2008-01-24 20:18:19 +0300
r14929 at riddle: andrew | 2008-01-24 11:17:36 -0600
Added the ping/reconnect on error as suggested by Jesse.
Modified: Jifty-DBI/branches/tisql/lib/Jifty/DBI/Handle.pm
==============================================================================
--- Jifty-DBI/branches/tisql/lib/Jifty/DBI/Handle.pm (original)
+++ Jifty-DBI/branches/tisql/lib/Jifty/DBI/Handle.pm Tue Feb 5 21:19:07 2008
@@ -550,6 +550,13 @@
{
no warnings 'uninitialized'; # undef in bind_values makes DBI sad
eval { $executed = $sth->execute(@bind_values) };
+
+ # try to ping and reconnect, if the DB connection failed
+ if ($@ and !$self->dbh->ping) {
+ $self->dbh(undef); # don't try pinging again, just connect
+ $self->connect;
+ eval { $executed = $sth->execute(@bind_values) };
+ }
}
if ( $self->log_sql_statements ) {
$self->_log_sql_statement( $query_string,
More information about the Jifty-commit
mailing list