Database: Set MySQL connection collation.

Fixes #36649.

Built from https://develop.svn.wordpress.org/trunk@37320


git-svn-id: http://core.svn.wordpress.org/trunk@37286 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Eric Lewis 2016-04-28 01:39:26 +00:00
parent d6a377acdc
commit cc1b2fae67
2 changed files with 9 additions and 11 deletions

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.6-alpha-37319';
$wp_version = '4.6-alpha-37320';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.

View File

@ -780,21 +780,19 @@ class wpdb {
if ( $this->use_mysqli ) {
if ( function_exists( 'mysqli_set_charset' ) && $this->has_cap( 'set_charset' ) ) {
mysqli_set_charset( $dbh, $charset );
} else {
$query = $this->prepare( 'SET NAMES %s', $charset );
if ( ! empty( $collate ) )
$query .= $this->prepare( ' COLLATE %s', $collate );
mysqli_query( $dbh, $query );
}
$query = $this->prepare( 'SET NAMES %s', $charset );
if ( ! empty( $collate ) )
$query .= $this->prepare( ' COLLATE %s', $collate );
mysqli_query( $dbh, $query );
} else {
if ( function_exists( 'mysql_set_charset' ) && $this->has_cap( 'set_charset' ) ) {
mysql_set_charset( $charset, $dbh );
} else {
$query = $this->prepare( 'SET NAMES %s', $charset );
if ( ! empty( $collate ) )
$query .= $this->prepare( ' COLLATE %s', $collate );
mysql_query( $query, $dbh );
}
$query = $this->prepare( 'SET NAMES %s', $charset );
if ( ! empty( $collate ) )
$query .= $this->prepare( ' COLLATE %s', $collate );
mysql_query( $query, $dbh );
}
}
}