Make WordPress Core


Ignore:
Timestamp:
04/28/2016 01:38:31 AM (9 years ago)
Author:
ericlewis
Message:

Database: Set MySQL connection collation.

Fixes #36649.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/wp-db.php

    r37292 r37320  
    781781                if ( function_exists( 'mysqli_set_charset' ) && $this->has_cap( 'set_charset' ) ) {
    782782                    mysqli_set_charset( $dbh, $charset );
    783                 } else {
    784                     $query = $this->prepare( 'SET NAMES %s', $charset );
    785                     if ( ! empty( $collate ) )
    786                         $query .= $this->prepare( ' COLLATE %s', $collate );
    787                     mysqli_query( $dbh, $query );
    788783                }
     784                $query = $this->prepare( 'SET NAMES %s', $charset );
     785                if ( ! empty( $collate ) )
     786                    $query .= $this->prepare( ' COLLATE %s', $collate );
     787                mysqli_query( $dbh, $query );
    789788            } else {
    790789                if ( function_exists( 'mysql_set_charset' ) && $this->has_cap( 'set_charset' ) ) {
    791790                    mysql_set_charset( $charset, $dbh );
    792                 } else {
    793                     $query = $this->prepare( 'SET NAMES %s', $charset );
    794                     if ( ! empty( $collate ) )
    795                         $query .= $this->prepare( ' COLLATE %s', $collate );
    796                     mysql_query( $query, $dbh );
    797791                }
     792                $query = $this->prepare( 'SET NAMES %s', $charset );
     793                if ( ! empty( $collate ) )
     794                    $query .= $this->prepare( ' COLLATE %s', $collate );
     795                mysql_query( $query, $dbh );
    798796            }
    799797        }
Note: See TracChangeset for help on using the changeset viewer.