From fce00c287bdf42564886061088374d0650303bd2 Mon Sep 17 00:00:00 2001 From: ryan Date: Fri, 27 May 2011 15:46:56 +0000 Subject: [PATCH] Properly handle return value of DDL statements. Props scribu, marcis20. fixes #11372 git-svn-id: http://svn.automattic.com/wordpress/trunk@18063 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/wp-db.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/wp-includes/wp-db.php b/wp-includes/wp-db.php index 999c0360b..11086c8d7 100644 --- a/wp-includes/wp-db.php +++ b/wp-includes/wp-db.php @@ -1082,10 +1082,12 @@ class wpdb { return false; } - if ( preg_match( "/^\\s*(insert|delete|update|replace|alter) /i", $query ) ) { + if ( preg_match( '/^\s*(create|alter|truncate|drop) /i', $query ) ) { + $return_val = $this->result; + } elseif ( preg_match( '/^\s*(insert|delete|update|replace) /i', $query ) ) { $this->rows_affected = mysql_affected_rows( $this->dbh ); // Take note of the insert_id - if ( preg_match( "/^\\s*(insert|replace) /i", $query ) ) { + if ( preg_match( '/^\s*(insert|replace) /i', $query ) ) { $this->insert_id = mysql_insert_id($this->dbh); } // Return number of rows affected