Fil's Patch to DB_DataObject to make it reconnect to the DB if
there's no connection. This patch has been added upstream and will be in the next release, but I need it now for the bidirectional bridge to work.
This commit is contained in:
parent
bc190595d1
commit
5771f413bb
@ -2358,6 +2358,8 @@ class DB_DataObject extends DB_DataObject_Overload
|
||||
$_DB_DATAOBJECT['QUERYENDTIME'] = $time = $t[0]+$t[1];
|
||||
|
||||
|
||||
do {
|
||||
|
||||
if ($_DB_driver == 'DB') {
|
||||
$result = $DB->query($string);
|
||||
} else {
|
||||
@ -2375,7 +2377,18 @@ class DB_DataObject extends DB_DataObject_Overload
|
||||
}
|
||||
}
|
||||
|
||||
// try to reconnect, at most 3 times
|
||||
$again = false;
|
||||
if (is_a($result, 'PEAR_Error')
|
||||
AND $result->getCode() == DB_ERROR_NODBSELECTED
|
||||
AND $cpt++<3) {
|
||||
$DB->disconnect();
|
||||
sleep(1);
|
||||
$DB->connect($DB->dsn);
|
||||
$again = true;
|
||||
}
|
||||
|
||||
} while ($again);
|
||||
|
||||
if (is_a($result,'PEAR_Error')) {
|
||||
if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) {
|
||||
|
Loading…
Reference in New Issue
Block a user