diff options
author | Andrey Andreev <narf@devilix.net> | 2014-05-09 09:24:14 +0200 |
---|---|---|
committer | Andrey Andreev <narf@devilix.net> | 2014-05-09 09:24:14 +0200 |
commit | 2bbbd1a13ead097fd3f4b00bfb275f0b0f836f93 (patch) | |
tree | 9a1615f486dac1502c024d8fcd57e066a875b4a2 /system/database/drivers/mysql | |
parent | 81b6efa76b90e28c87d1efad50dc13c2ac462ca8 (diff) |
Remove (most of) error suppression from database drivers (issue #3036)
Diffstat (limited to 'system/database/drivers/mysql')
-rw-r--r-- | system/database/drivers/mysql/mysql_driver.php | 15 | ||||
-rw-r--r-- | system/database/drivers/mysql/mysql_result.php | 6 |
2 files changed, 12 insertions, 9 deletions
diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php index 9fbd94ce8..7cbcf1028 100644 --- a/system/database/drivers/mysql/mysql_driver.php +++ b/system/database/drivers/mysql/mysql_driver.php @@ -119,6 +119,7 @@ class CI_DB_mysql_driver extends CI_DB { $client_flags = $client_flags | MYSQL_CLIENT_SSL; } + // Error suppression is necessary mostly due to PHP 5.5+ issuing E_DEPRECATED messages $this->conn_id = ($persistent === TRUE) ? @mysql_pconnect($this->hostname, $this->username, $this->password, $client_flags) : @mysql_connect($this->hostname, $this->username, $this->password, TRUE, $client_flags); @@ -176,7 +177,7 @@ class CI_DB_mysql_driver extends CI_DB { $database = $this->database; } - if (@mysql_select_db($database, $this->conn_id)) + if (mysql_select_db($database, $this->conn_id)) { $this->database = $database; return TRUE; @@ -195,7 +196,7 @@ class CI_DB_mysql_driver extends CI_DB { */ protected function _db_set_charset($charset) { - return @mysql_set_charset($charset, $this->conn_id); + return mysql_set_charset($charset, $this->conn_id); } // -------------------------------------------------------------------- @@ -216,7 +217,7 @@ class CI_DB_mysql_driver extends CI_DB { $this->initialize(); } - if ( ! $this->conn_id OR ($version = @mysql_get_server_info($this->conn_id)) === FALSE) + if ( ! $this->conn_id OR ($version = mysql_get_server_info($this->conn_id)) === FALSE) { return FALSE; } @@ -234,7 +235,7 @@ class CI_DB_mysql_driver extends CI_DB { */ protected function _execute($sql) { - return @mysql_query($this->_prep_query($sql), $this->conn_id); + return mysql_query($this->_prep_query($sql), $this->conn_id); } // -------------------------------------------------------------------- @@ -349,7 +350,7 @@ class CI_DB_mysql_driver extends CI_DB { */ public function affected_rows() { - return @mysql_affected_rows($this->conn_id); + return mysql_affected_rows($this->conn_id); } // -------------------------------------------------------------------- @@ -361,7 +362,7 @@ class CI_DB_mysql_driver extends CI_DB { */ public function insert_id() { - return @mysql_insert_id($this->conn_id); + return mysql_insert_id($this->conn_id); } // -------------------------------------------------------------------- @@ -484,6 +485,8 @@ class CI_DB_mysql_driver extends CI_DB { */ protected function _close() { + // Error suppression to avoid annoying E_WARNINGs in cases + // where the connection has already been closed for some reason. @mysql_close($this->conn_id); } diff --git a/system/database/drivers/mysql/mysql_result.php b/system/database/drivers/mysql/mysql_result.php index c232b5c90..68860e60c 100644 --- a/system/database/drivers/mysql/mysql_result.php +++ b/system/database/drivers/mysql/mysql_result.php @@ -50,7 +50,7 @@ class CI_DB_mysql_result extends CI_DB_result { // Required, due to mysql_data_seek() causing nightmares // with empty result sets - $this->num_rows = @mysql_num_rows($this->result_id); + $this->num_rows = mysql_num_rows($this->result_id); } // -------------------------------------------------------------------- @@ -74,7 +74,7 @@ class CI_DB_mysql_result extends CI_DB_result { */ public function num_fields() { - return @mysql_num_fields($this->result_id); + return mysql_num_fields($this->result_id); } // -------------------------------------------------------------------- @@ -153,7 +153,7 @@ class CI_DB_mysql_result extends CI_DB_result { public function data_seek($n = 0) { return $this->num_rows - ? @mysql_data_seek($this->result_id, $n) + ? mysql_data_seek($this->result_id, $n) : FALSE; } |