summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/mysql/mysql_driver.php
diff options
context:
space:
mode:
authorKyle Farris <kylefarris@kylefarris.gotdns.org>2011-10-14 18:48:53 +0200
committerKyle Farris <kylefarris@kylefarris.gotdns.org>2011-10-14 18:48:53 +0200
commit974cc5757e1da3a89af7b9bc700b805ba05dd3bb (patch)
tree109313ba07a2eed2bb8d015ef5f6af8f9205dae2 /system/database/drivers/mysql/mysql_driver.php
parent6636cef6fc457b3a0490d051587cb430aa0021d0 (diff)
parenta2125a5d830fd390b4cf35f77e9bb0558cfa2dd7 (diff)
Merged with develop and updated to new changelog.
Diffstat (limited to 'system/database/drivers/mysql/mysql_driver.php')
-rw-r--r--system/database/drivers/mysql/mysql_driver.php19
1 files changed, 4 insertions, 15 deletions
diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php
index f87cfea4b..dc020c624 100644
--- a/system/database/drivers/mysql/mysql_driver.php
+++ b/system/database/drivers/mysql/mysql_driver.php
@@ -56,7 +56,7 @@ class CI_DB_mysql_driver extends CI_DB {
// whether SET NAMES must be used to set the character set
var $use_set_names;
-
+
/**
* Non-persistent database connection
*
@@ -135,20 +135,9 @@ class CI_DB_mysql_driver extends CI_DB {
*/
function db_set_charset($charset, $collation)
{
- if ( ! isset($this->use_set_names))
- {
- // mysql_set_charset() requires PHP >= 5.2.3 and MySQL >= 5.0.7, use SET NAMES as fallback
- $this->use_set_names = (version_compare(PHP_VERSION, '5.2.3', '>=') && version_compare(mysql_get_server_info(), '5.0.7', '>=')) ? FALSE : TRUE;
- }
-
- if ($this->use_set_names === TRUE)
- {
- return @mysql_query("SET NAMES '".$this->escape_str($charset)."' COLLATE '".$this->escape_str($collation)."'", $this->conn_id);
- }
- else
- {
- return @mysql_set_charset($charset, $this->conn_id);
- }
+ 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);
}
// --------------------------------------------------------------------