summaryrefslogtreecommitdiff
path: root/extlib/DB/DataObject.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-05-11 17:53:23 -0400
committerEvan Prodromou <evan@controlyourself.ca>2009-05-11 17:53:23 -0400
commit99f8501d321ae9d8087abbe6523e28ce5fd095d3 (patch)
treefb721b4360f0748df3cb3b522565ad4566422555 /extlib/DB/DataObject.php
parent7f0e57598a5837bbb87f197baa147be29c7df531 (diff)
parent251fd2c232d96ea09db971a6608231c679395c01 (diff)
Merge branch '0.8.x' of git@gitorious.org:laconica/dev into 0.8.x
Conflicts: config.php.sample
Diffstat (limited to 'extlib/DB/DataObject.php')
-rw-r--r--extlib/DB/DataObject.php17
1 files changed, 15 insertions, 2 deletions
diff --git a/extlib/DB/DataObject.php b/extlib/DB/DataObject.php
index b1a1a4e21..0c6a13dc2 100644
--- a/extlib/DB/DataObject.php
+++ b/extlib/DB/DataObject.php
@@ -2357,6 +2357,8 @@ class DB_DataObject extends DB_DataObject_Overload
$t= explode(' ',microtime());
$_DB_DATAOBJECT['QUERYENDTIME'] = $time = $t[0]+$t[1];
+
+ do {
if ($_DB_driver == 'DB') {
$result = $DB->query($string);
@@ -2374,8 +2376,19 @@ class DB_DataObject extends DB_DataObject_Overload
break;
}
}
-
-
+
+ // 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'])) {