[Jifty-commit] r4928 - in Jifty-DBI/trunk: lib/Jifty/DBI
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Thu Jan 24 12:18:19 EST 2008
Author: sterling
Date: Thu Jan 24 12:18:19 2008
New Revision: 4928
Modified:
Jifty-DBI/trunk/ (props changed)
Jifty-DBI/trunk/lib/Jifty/DBI/Handle.pm
Log:
r14929 at riddle: andrew | 2008-01-24 11:17:36 -0600
Added the ping/reconnect on error as suggested by Jesse.
Modified: Jifty-DBI/trunk/lib/Jifty/DBI/Handle.pm
==============================================================================
--- Jifty-DBI/trunk/lib/Jifty/DBI/Handle.pm (original)
+++ Jifty-DBI/trunk/lib/Jifty/DBI/Handle.pm Thu Jan 24 12:18:19 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