修改\class\database\adodb\drivers\adodb-mysql.inc.php後果然就正常了。
我把1.0版中存在但1.0.1版消失的三段hacks全帶進來。
else if (ADODB_PHPVER >= 0x4200)
$this->_connectionID = mysql_connect($argHostname,$argUsername,$argPassword,
$this->forceNewConnect);
else
$this->_connectionID = mysql_connect($argHostname,$argUsername,$argPassword);
/** hack to adodb **/
if ($this->_isSupportUtf8() && $argDatabasename) {
$dbEncoding = $this->_getDbDefaultEncoding($argDatabasename);
if ($dbEncoding) {
mysql_query("SET NAMES $dbEncoding", $this->_connectionID);
}
}
/** end of hack **/
if ($this->_connectionID === false) return false;
if ($argDatabasename) return $this->SelectDB($argDatabasename);
return true;
if ($this->_connectionID === false) return false;
if ($this->autoRollback) $this->RollbackTrans();
/** hack to adodb **/
if ($this->_isSupportUtf8() && $argDatabasename) {
$dbEncoding = $this->_getDbDefaultEncoding($argDatabasename);
if ($dbEncoding) {
mysql_query("SET NAMES $dbEncoding", $this->_connectionID);
}
}
/** end of hack **/
if ($argDatabasename) return $this->SelectDB($argDatabasename);
return true;
$this->forceNewConnect = true;
return $this->_connect($argHostname, $argUsername, $argPassword, $argDatabasename);
}
/** start of adodb hack **/
function _isSupportUtf8() {
// check mysql version first. Version lower than 4.1 doesn't support utf8
$serverVersion = mysql_get_server_info($this->_connectionID);
$version = explode('.', $serverVersion);
if ($version[0] < 4) return false;
if ( ($version[0] == 4) && ($version[1] == 0) ) return false;
// check if utf8 support was compiled in
$result = mysql_query("SHOW CHARACTER SET like 'utf8'", $this->_connectionID);
if (mysql_num_rows($result) > 0) {
return true;
}
return false;
}
function _getDbDefaultEncoding($argDatabasename)
{
if (!$argDatabasename) {
return false;
}
// We use a SHOW CREATE DATABASE command to show the original
// SQL character set when DB was created.
$result = mysql_query("SHOW CREATE DATABASE $argDatabasename", $this->_connectionID);
if (mysql_num_rows($result) < 0 ) {
// The specified db name is wrong!
return false;
}
$dbInfo = mysql_fetch_row($result);
$pattern = '/40100 DEFAULT CHARACTER SET (\w+) /';
if ( (preg_match($pattern, $dbInfo[1], $match) > 0) ) {
return $match[1];
}
return false;
}
/** end of hack **/
function &MetaColumns($table)