Don't block SET NAMES query. Props g30rg3x for the find. fixes #5503 for 2.4

git-svn-id: https://develop.svn.wordpress.org/trunk@6464 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2007-12-22 06:24:48 +00:00
parent c8e824c3fe
commit 7e06628e1b
1 changed files with 3 additions and 1 deletions

View File

@ -76,11 +76,12 @@ class wpdb {
return; return;
} }
$this->ready = true;
if ( !empty($this->charset) && version_compare(mysql_get_server_info(), '4.1.0', '>=') ) if ( !empty($this->charset) && version_compare(mysql_get_server_info(), '4.1.0', '>=') )
$this->query("SET NAMES '$this->charset'"); $this->query("SET NAMES '$this->charset'");
$this->select($dbname); $this->select($dbname);
$this->ready = true;
} }
function __destruct() { function __destruct() {
@ -113,6 +114,7 @@ class wpdb {
*/ */
function select($db) { function select($db) {
if (!@mysql_select_db($db, $this->dbh)) { if (!@mysql_select_db($db, $this->dbh)) {
$this->ready = false;
$this->bail(" $this->bail("
<h1>Can&#8217;t select database</h1> <h1>Can&#8217;t select database</h1>
<p>We were able to connect to the database server (which means your username and password is okay) but not able to select the <code>$db</code> database.</p> <p>We were able to connect to the database server (which means your username and password is okay) but not able to select the <code>$db</code> database.</p>