diff options
author | Andrey Andreev <narf@bofh.bg> | 2012-03-03 03:37:04 +0100 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2012-03-03 03:37:04 +0100 |
commit | 8741dda98f2cf4be982ce0cb4f6f798d2b53c0a9 (patch) | |
tree | 19b1d7b1d8ca0b5fdefd8298cdb58b7657d22dc9 /system/database/drivers/mysql | |
parent | 041f1e526a186a729a5cb3c62a0581723056b851 (diff) | |
parent | a19beb0c580ac78c4b75548a046240a85f30cb29 (diff) |
Merge upstream branch
Diffstat (limited to 'system/database/drivers/mysql')
-rw-r--r-- | system/database/drivers/mysql/mysql_driver.php | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php index c88a8a766..84f7791c7 100644 --- a/system/database/drivers/mysql/mysql_driver.php +++ b/system/database/drivers/mysql/mysql_driver.php @@ -147,7 +147,7 @@ class CI_DB_mysql_driver extends CI_DB { * @param string * @return bool */ - public function db_set_charset($charset, $collation) + protected function _db_set_charset($charset, $collation) { return function_exists('mysql_set_charset') ? @mysql_set_charset($charset, $this->conn_id) @@ -157,13 +157,15 @@ class CI_DB_mysql_driver extends CI_DB { // -------------------------------------------------------------------- /** - * Version number query string + * Database version number * * @return string */ - protected function _version() + public function version() { - return 'SELECT version() AS ver'; + return isset($this->data_cache['version']) + ? $this->data_cache['version'] + : $this->data_cache['version'] = @mysql_get_server_info($this->conn_id); } // -------------------------------------------------------------------- @@ -417,25 +419,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)); } // -------------------------------------------------------------------- |