diff options
author | Timothy Warren <tim@timshomepage.net> | 2012-03-02 15:29:27 +0100 |
---|---|---|
committer | Timothy Warren <tim@timshomepage.net> | 2012-03-02 15:29:27 +0100 |
commit | 6a3bda6a1fee45635f66f4e22d288f73334e9e48 (patch) | |
tree | 9a4a785e31daa46465e08a0b60ba7d076df04d6a /system/database/drivers/mysqli/mysqli_driver.php | |
parent | 2d04624cb59d5852f8e61d610ab822252cad685a (diff) | |
parent | 06400c0397793132e7517a1e414d104800e16667 (diff) |
Merge branch 'develop' of git://github.com/EllisLab/CodeIgniter into develop
Diffstat (limited to 'system/database/drivers/mysqli/mysqli_driver.php')
-rw-r--r-- | system/database/drivers/mysqli/mysqli_driver.php | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php index a79b2a4ad..031371345 100644 --- a/system/database/drivers/mysqli/mysqli_driver.php +++ b/system/database/drivers/mysqli/mysqli_driver.php @@ -119,11 +119,23 @@ class CI_DB_mysqli_driver extends CI_DB { /** * Select the database * + * @param string database name * @return bool */ - public function db_select() + public function db_select($database = '') { - return @mysqli_select_db($this->conn_id, $this->database); + if ($database === '') + { + $database = $this->database; + } + + if (@mysqli_select_db($this->conn_id, $database)) + { + $this->database = $database; + return TRUE; + } + + return FALSE; } // -------------------------------------------------------------------- @@ -406,25 +418,16 @@ class CI_DB_mysqli_driver extends CI_DB { // -------------------------------------------------------------------- /** - * The error message string + * Error * - * @return string - */ - protected function _error_message() - { - return mysqli_error($this->conn_id); - } - - // -------------------------------------------------------------------- - - /** - * The error message number + * Returns an array containing code and message of the last + * database error that has occured. * - * @return int + * @return array */ - protected function _error_number() + public function error() { - return mysqli_errno($this->conn_id); + return array('code' => mysqli_errno($this->conn_id), 'message' => mysqli_error($this->conn_id)); } // -------------------------------------------------------------------- |