diff options
author | Aleksander Machniak <alec@alec.pl> | 2012-08-08 09:42:54 +0200 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2012-08-08 09:42:54 +0200 |
commit | ea08d4c9617b2ffd36a53d3759e102a3c52ef69b (patch) | |
tree | 49a793bc8bbbc635f16ecf52184d72f6cd45e51d | |
parent | 10db0aaf3806686540aea4dcaeb0fa4faffebb8d (diff) |
Improve is_error() so we can check for state of specified query
-rw-r--r-- | program/include/rcube_db.php | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/program/include/rcube_db.php b/program/include/rcube_db.php index 33dcbe975..01abfc8b4 100644 --- a/program/include/rcube_db.php +++ b/program/include/rcube_db.php @@ -266,11 +266,17 @@ class rcube_db /** * Getter for error state * - * @return boolean True on error + * @param int $res_id Optional query result identifier + * + * @return boolean True on error, False otherwise */ - public function is_error() + public function is_error($res_id = null) { - return $this->db_error ? $this->db_error_msg : false; + if ($res_id !== null) { + return $this->_get_result($res_id) === false; + } + + return $this->db_error; } /** |