From 26d857447f5a9d2e8a9c44fd5707a18523926e1d Mon Sep 17 00:00:00 2001 From: alecpl Date: Sat, 9 May 2009 20:07:10 +0000 Subject: - Fix session handling on non-session SQL query error (#1485734) --- program/include/rcube_mdb2.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'program/include/rcube_mdb2.php') 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 @@ -177,6 +177,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 * @@ -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); -- cgit v1.2.3