diff options
author | Andrey Andreev <narf@bofh.bg> | 2012-03-13 11:51:33 +0100 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2012-03-13 11:51:33 +0100 |
commit | c1cda232d690723db6e704b738c91f84cfc49a9e (patch) | |
tree | a7e91130e3b6139f5ce9f515635863eee457cb7e /system/database/drivers | |
parent | 30da39bb5d65c37203c12a42dfc50f7d231fb2d1 (diff) | |
parent | d153002858256c6f206c8877f4952ed075902f9e (diff) |
Merge upstream branch
Diffstat (limited to 'system/database/drivers')
-rw-r--r-- | system/database/drivers/mysql/mysql_driver.php | 20 | ||||
-rw-r--r-- | system/database/drivers/mysqli/mysqli_driver.php | 20 |
2 files changed, 6 insertions, 34 deletions
diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php index 7f4a4f2ca..ba646d226 100644 --- a/system/database/drivers/mysql/mysql_driver.php +++ b/system/database/drivers/mysql/mysql_driver.php @@ -144,14 +144,11 @@ class CI_DB_mysql_driver extends CI_DB { * Set client character set * * @param string - * @param string * @return bool */ - protected function _db_set_charset($charset, $collation) + protected function _db_set_charset($charset) { - return function_exists('mysql_set_charset') - ? @mysql_set_charset($charset, $this->conn_id) - : @mysql_query("SET NAMES '".$this->escape_str($charset)."' COLLATE '".$this->escape_str($collation)."'", $this->conn_id); + return @mysql_set_charset($charset, $this->conn_id); } // -------------------------------------------------------------------- @@ -289,18 +286,7 @@ class CI_DB_mysql_driver extends CI_DB { return $str; } - if (function_exists('mysql_real_escape_string') && is_resource($this->conn_id)) - { - $str = mysql_real_escape_string($str, $this->conn_id); - } - elseif (function_exists('mysql_escape_string')) - { - $str = mysql_escape_string($str); - } - else - { - $str = addslashes($str); - } + $str = is_resource($this->conn_id) ? mysql_real_escape_string($str, $this->conn_id) : addslashes($str); // escape LIKE condition wildcards if ($like === TRUE) diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php index 846ec0340..f38b94c13 100644 --- a/system/database/drivers/mysqli/mysqli_driver.php +++ b/system/database/drivers/mysqli/mysqli_driver.php @@ -144,14 +144,11 @@ class CI_DB_mysqli_driver extends CI_DB { * Set client character set * * @param string - * @param string * @return bool */ - protected function _db_set_charset($charset, $collation) + protected function _db_set_charset($charset) { - return function_exists('mysqli_set_charset') - ? @mysqli_set_charset($this->conn_id, $charset) - : @mysqli_query($this->conn_id, "SET NAMES '".$this->escape_str($charset)."' COLLATE '".$this->escape_str($collation)."'"); + return @mysqli_set_charset($this->conn_id, $charset); } // -------------------------------------------------------------------- @@ -289,18 +286,7 @@ class CI_DB_mysqli_driver extends CI_DB { return $str; } - if (function_exists('mysqli_real_escape_string') && is_object($this->conn_id)) - { - $str = mysqli_real_escape_string($this->conn_id, $str); - } - elseif (function_exists('mysql_escape_string')) - { - $str = mysql_escape_string($str); - } - else - { - $str = addslashes($str); - } + $str = is_object($this->conn_id) ? mysqli_real_escape_string($this->conn_id, $str) : addslashes($str); // escape LIKE condition wildcards if ($like === TRUE) |