summaryrefslogtreecommitdiff
path: root/program/include/rcube_mdb2.php
diff options
context:
space:
mode:
Diffstat (limited to 'program/include/rcube_mdb2.php')
-rw-r--r--program/include/rcube_mdb2.php16
1 files changed, 15 insertions, 1 deletions
diff --git a/program/include/rcube_mdb2.php b/program/include/rcube_mdb2.php
index 713ff4255..b1e5fff80 100644
--- a/program/include/rcube_mdb2.php
+++ b/program/include/rcube_mdb2.php
@@ -178,6 +178,17 @@ class rcube_mdb2
/**
+ * Connection state checker
+ *
+ * @param boolean True if in connected state
+ */
+ function is_connected()
+ {
+ return PEAR::isError($this->db_handle) ? false : true;
+ }
+
+
+ /**
* Execute a SQL query
*
* @param string SQL query to execute
@@ -187,6 +198,9 @@ class rcube_mdb2
*/
function query()
{
+ if (!$this->is_connected())
+ return NULL;
+
$params = func_get_args();
$query = array_shift($params);
@@ -360,7 +374,7 @@ class rcube_mdb2
*/
function _fetch_row($result, $mode)
{
- if ($result === FALSE || PEAR::isError($result))
+ if ($result === FALSE || PEAR::isError($result) || !$this->is_connected())
return FALSE;
return $result->fetchRow($mode);