From 5f8adabb6286fdcb0ff8a0ea5d1d58f40eef51f4 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Mon, 27 Aug 2012 03:28:16 -0400
Subject: [PATCH] Add simple (constructor) tests for Framework classes
---
program/include/rcube_db.php | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/program/include/rcube_db.php b/program/include/rcube_db.php
index 33dcbe9..f97d70a 100644
--- a/program/include/rcube_db.php
+++ b/program/include/rcube_db.php
@@ -266,11 +266,17 @@
/**
* Getter for error state
*
- * @return boolean True on error
+ * @param int $res_id Optional query result identifier
+ *
+ * @return string Error message
*/
- 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 ? $this->db_error_msg : null;
+ }
+
+ return $this->db_error ? $this->db_error_msg : null;
}
/**
@@ -570,6 +576,10 @@
return intval($input);
}
+ if (is_null($input)) {
+ return 'NULL';
+ }
+
// create DB handle if not available
if (!$this->dbh) {
$this->db_connect('r');
--
Gitblit v1.9.1