Add Cxn::lost_connection(). Rename runtime to run_time in Runtime.pm.

This commit is contained in:
Daniel Nichter
2013-02-25 11:52:22 -07:00
parent 8e449a1c83
commit c3740b7aac
2 changed files with 29 additions and 33 deletions

View File

@@ -173,6 +173,15 @@ sub set_dbh {
return $dbh;
}
sub lost_connection {
my ($self, $e) = @_;
return 0 unless $e;
return $e =~ m/MySQL server has gone away/
|| $e =~ m/Lost connection to MySQL server/;
# The 1st pattern means that MySQL itself died or was stopped.
# The 2nd pattern means that our cxn was killed (KILL <id>).
}
# Sub: dbh
# Return the cxn's dbh.
sub dbh {