summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/mysql/mysql_driver.php
diff options
context:
space:
mode:
Diffstat (limited to 'system/database/drivers/mysql/mysql_driver.php')
-rw-r--r--system/database/drivers/mysql/mysql_driver.php37
1 files changed, 20 insertions, 17 deletions
diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php
index 067710ff0..a7f08d1a8 100644
--- a/system/database/drivers/mysql/mysql_driver.php
+++ b/system/database/drivers/mysql/mysql_driver.php
@@ -119,11 +119,23 @@ class CI_DB_mysql_driver extends CI_DB {
/**
* Select the database
*
+ * @param string database name
* @return bool
*/
- public function db_select()
+ public function db_select($database = '')
{
- return @mysql_select_db($this->database, $this->conn_id);
+ if ($database === '')
+ {
+ $database = $this->database;
+ }
+
+ if (@mysql_select_db($database, $this->conn_id))
+ {
+ $this->database = $database;
+ return TRUE;
+ }
+
+ return FALSE;
}
// --------------------------------------------------------------------
@@ -405,25 +417,16 @@ class CI_DB_mysql_driver extends CI_DB {
// --------------------------------------------------------------------
/**
- * The error message string
+ * Error
*
- * @return string
- */
- protected function _error_message()
- {
- return mysql_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 mysql_errno($this->conn_id);
+ return array('code' => mysql_errno($this->conn_id), 'message' => mysql_error($this->conn_id));
}
// --------------------------------------------------------------------