summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/mysqli
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-03-12 14:34:10 +0100
committerAndrey Andreev <narf@bofh.bg>2012-03-12 14:34:10 +0100
commitf6a4114e57a305d0b2fd24a23f9e643290e71eec (patch)
treec4dc19fd1c6fdaacb4b15f55b30ae008bd59b88b /system/database/drivers/mysqli
parent5f98a1091c70e29c7596917604ec478aea443122 (diff)
Remove usage of SET NAMES and the deprecated mysql_escape_string() from MySQL/MySQLi drivers
Diffstat (limited to 'system/database/drivers/mysqli')
-rw-r--r--system/database/drivers/mysqli/mysqli_driver.php17
1 files changed, 2 insertions, 15 deletions
diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php
index 846ec0340..a965e619a 100644
--- a/system/database/drivers/mysqli/mysqli_driver.php
+++ b/system/database/drivers/mysqli/mysqli_driver.php
@@ -149,9 +149,7 @@ class CI_DB_mysqli_driver extends CI_DB {
*/
protected function _db_set_charset($charset, $collation)
{
- 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 +287,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)