diff options
author | Greg Aker <greg@gregaker.net> | 2011-08-20 20:58:37 +0200 |
---|---|---|
committer | Greg Aker <greg@gregaker.net> | 2011-08-20 20:58:37 +0200 |
commit | 394d8c5bd3e04bd7992793ca7c648f4306a9539d (patch) | |
tree | d061b4339f2c3f30428256efae741ab04fd2bf6e /system/database/drivers/mysql/mysql_driver.php | |
parent | 43194ea1af658914a89ca49aed4dca4617b9c4ff (diff) | |
parent | d56be70257696d0bbf2dcc880888d8dc17cba21c (diff) |
Merge branch 'develop' of github.com:EllisLab/CodeIgniter into develop
Diffstat (limited to 'system/database/drivers/mysql/mysql_driver.php')
-rw-r--r-- | system/database/drivers/mysql/mysql_driver.php | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php index b7d547cc0..28c75a5e3 100644 --- a/system/database/drivers/mysql/mysql_driver.php +++ b/system/database/drivers/mysql/mysql_driver.php @@ -54,6 +54,9 @@ class CI_DB_mysql_driver extends CI_DB { var $_count_string = 'SELECT COUNT(*) AS '; var $_random_keyword = ' RAND()'; // database specific random keyword + // whether SET NAMES must be used to set the character set + var $use_set_names; + /** * Non-persistent database connection * @@ -132,15 +135,13 @@ class CI_DB_mysql_driver extends CI_DB { */ function db_set_charset($charset, $collation) { - static $use_set_names; - - if ( ! isset($use_set_names)) + if ( ! isset($this->use_set_names)) { // mysql_set_charset() requires PHP >= 5.2.3 and MySQL >= 5.0.7, use SET NAMES as fallback - $use_set_names = (version_compare(PHP_VERSION, '5.2.3', '>=') && version_compare(mysql_get_server_info(), '5.0.7', '>=')) ? FALSE : TRUE; + $this->use_set_names = (version_compare(PHP_VERSION, '5.2.3', '>=') && version_compare(mysql_get_server_info(), '5.0.7', '>=')) ? FALSE : TRUE; } - if ($use_set_names) + if ($this->use_set_names === TRUE) { return @mysql_query("SET NAMES '".$this->escape_str($charset)."' COLLATE '".$this->escape_str($collation)."'", $this->conn_id); } |