summaryrefslogtreecommitdiff
path: root/program/include/rcube_mdb2.php
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2009-05-09 20:07:10 +0000
committeralecpl <alec@alec.pl>2009-05-09 20:07:10 +0000
commit26d857447f5a9d2e8a9c44fd5707a18523926e1d (patch)
tree94fee71badd2967ca74ebf8c17ec27c2bb31563c /program/include/rcube_mdb2.php
parentae1df26948104dcc0a97bd83b189a36c69f37977 (diff)
- Fix session handling on non-session SQL query error (#1485734)
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);