forked from GNUsocial/gnu-social
Use mysql_set_charset for connection instead of SET NAMES
PHP doesn't get the info about the charset of the connection if you use SET NAMES. So, we use the appropriate PHP function instead.
This commit is contained in:
parent
a262f83210
commit
9e16b7d89b
@ -239,8 +239,14 @@ class Memcached_DataObject extends DB_DataObject
|
|||||||
$result = parent::_connect();
|
$result = parent::_connect();
|
||||||
if (!$exists) {
|
if (!$exists) {
|
||||||
$DB = &$_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5];
|
$DB = &$_DB_DATAOBJECT['CONNECTIONS'][$this->_database_dsn_md5];
|
||||||
if (common_config('db', 'utf8')) {
|
if (common_config('db', 'type') == 'mysql' &&
|
||||||
$DB->query('SET NAMES "utf8"');
|
common_config('db', 'utf8')) {
|
||||||
|
$conn = $DB->connection;
|
||||||
|
if ($DB instanceof DB_mysqli) {
|
||||||
|
mysqli_set_charset($conn, 'utf8');
|
||||||
|
} else if ($DB instanceof DB_mysql) {
|
||||||
|
mysql_set_charset('utf8', $conn);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
|
Loading…
Reference in New Issue
Block a user