diff options
author | Derek Jones <derek.jones@ellislab.com> | 2011-04-20 02:47:34 +0200 |
---|---|---|
committer | Derek Jones <derek.jones@ellislab.com> | 2011-04-20 02:47:34 +0200 |
commit | bab1a6aab7aa9bd2ba0ad7bc51973dd00d273b31 (patch) | |
tree | a2360c3d03813783d0fca44b1fe2947e9873fb26 /system/database/drivers/mysqli | |
parent | f5c840241084e03d49e521bfcb62d2adbe9fce7d (diff) | |
parent | 6ae70cc8499499b5d77d77ec8974f95873edb861 (diff) |
Automated merge with http://hg.ellislab.com/CodeIgniter-Reactor
Diffstat (limited to 'system/database/drivers/mysqli')
-rw-r--r-- | system/database/drivers/mysqli/mysqli_driver.php | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php index ccdabce1a..1949acb6e 100644 --- a/system/database/drivers/mysqli/mysqli_driver.php +++ b/system/database/drivers/mysqli/mysqli_driver.php @@ -132,7 +132,22 @@ class CI_DB_mysqli_driver extends CI_DB { */ function _db_set_charset($charset, $collation) { - return @mysqli_query($this->conn_id, "SET NAMES '".$this->escape_str($charset)."' COLLATE '".$this->escape_str($collation)."'"); + static $use_set_names; + + if ( ! isset($use_set_names)) + { + // mysqli_set_charset() requires MySQL >= 5.0.7, use SET NAMES as fallback + $use_set_names = (version_compare(mysql_get_server_info(), '5.0.7', '>=')) ? FALSE : TRUE; + } + + if ($use_set_names) + { + return @mysqli_query($this->conn_id, "SET NAMES '".$this->escape_str($charset)."' COLLATE '".$this->escape_str($collation)."'"); + } + else + { + return @mysqli_set_charset($this->conn_id, $charset); + } } // -------------------------------------------------------------------- |