From 74a7fc7923dff0164647bb87560aae233a552aec Mon Sep 17 00:00:00 2001 From: westi Date: Sun, 30 Mar 2008 17:56:27 +0000 Subject: [PATCH] Specify collation as well when connecting to the database if it is provided. See #6410 for trunk. git-svn-id: http://svn.automattic.com/wordpress/trunk@7579 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/wp-db.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/wp-includes/wp-db.php b/wp-includes/wp-db.php index 216c9cf02..920b7f948 100644 --- a/wp-includes/wp-db.php +++ b/wp-includes/wp-db.php @@ -84,9 +84,19 @@ class wpdb { $this->ready = true; - if ( !empty($this->charset) && version_compare(mysql_get_server_info($this->dbh), '4.1.0', '>=') ) - $this->query("SET NAMES '$this->charset'"); - + if ( $this->supports_collation() ) { + $collation_query = ''; + if ( !empty($this->charset) ) { + $collation_query = "SET NAMES '{$this->charset}'"; + if (!empty($this->collate) ) + $collation_query .= " COLLATE '{$this->collate}'"; + } + + if ( !empty($collation_query) ) + $this->query($collation_query); + + } + $this->select($dbname); }