Don't consider the connection active if the connection object is missing/false, and...
authorChuck Hagenbuch <chuck@horde.org>
Tue, 25 Jan 2011 14:04:59 +0000 (09:04 -0500)
committerChuck Hagenbuch <chuck@horde.org>
Wed, 26 Jan 2011 18:05:11 +0000 (13:05 -0500)
framework/Db/lib/Horde/Db/Adapter/Base.php

index 608e894..a34247e 100644 (file)
@@ -332,7 +332,7 @@ abstract class Horde_Db_Adapter_Base implements Horde_Db_Adapter
      */
     public function isActive()
     {
-        return $this->_active;
+        return $this->_active && $this->_connection;
     }
 
     /**
@@ -517,6 +517,8 @@ abstract class Horde_Db_Adapter_Base implements Horde_Db_Adapter
      */
     public function execute($sql, $arg1 = null, $arg2 = null)
     {
+        if (!$this->isActive()) { $this->reconnect(); }
+
         if (is_array($arg1)) {
             $sql = $this->_replaceParameters($sql, $arg1);
             $name = $arg2;