Browse Source

修正在高版本数据库中出现乱码的错误

tags/6.0.1
tianya 2 months ago
parent
commit
61d31a2434
2 changed files with 3 additions and 4 deletions
  1. +2
    -3
      src/include/dedesql.class.php
  2. +1
    -1
      src/include/dedesqli.class.php

+ 2
- 3
src/include/dedesql.class.php View File

@@ -137,10 +137,9 @@ class DedeSql
@mysql_select_db($this->dbName, $this->linkID);
$mysqlver = explode('.',$this->GetVersion());
$mysqlver = $mysqlver[0].'.'.$mysqlver[1];
if($mysqlver>4.0)
if (version_compare($mysqlver,'4.0',">=") && $GLOBALS['cfg_db_language'])
{
@mysql_query("SET NAMES '".$GLOBALS['cfg_db_language']."', character_set_client=binary, sql_mode='', interactive_timeout=3600 ;", $this->linkID);
@mysql_query($this->linkID, "SET character_set_connection=" . $GLOBALS['cfg_db_language'] . ",character_set_results=" . $GLOBALS['cfg_db_language'] . ",character_set_client=binary");
}
return TRUE;


+ 1
- 1
src/include/dedesqli.class.php View File

@@ -140,7 +140,7 @@ class DedeSqli
}
$this->isInit = TRUE;
$serverinfo = mysqli_get_server_info($this->linkID);
if ($serverinfo > '4.1' && $GLOBALS['cfg_db_language'])
if (version_compare($serverinfo,'4.1',">=") && $GLOBALS['cfg_db_language'])
{
mysqli_query($this->linkID, "SET character_set_connection=" . $GLOBALS['cfg_db_language'] . ",character_set_results=" . $GLOBALS['cfg_db_language'] . ",character_set_client=binary");
}


Loading…
Cancel
Save