X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/b137f4ce021b4022c56f452c2eafa7abfcef0a7c..b3ddbea8a296025a672b3c3ddca158dc51ed8080:/wp-includes/wp-db.php diff --git a/wp-includes/wp-db.php b/wp-includes/wp-db.php index a90c2814..0cae3e63 100644 --- a/wp-includes/wp-db.php +++ b/wp-includes/wp-db.php @@ -39,9 +39,8 @@ define( 'ARRAY_N', 'ARRAY_N' ); * * It is possible to replace this class with your own * by setting the $wpdb global variable in wp-content/db.php - * file with your class. You can name it wpdb also, since - * this file will not be included, if the other file is - * available. + * file to your class. The wpdb class will still be included, + * so you can extend it or simply use your own. * * @link http://codex.wordpress.org/Function_Reference/wpdb_Class * @@ -461,23 +460,6 @@ class wpdb { */ var $func_call; - /** - * Connects to the database server and selects a database - * - * PHP4 compatibility layer for calling the PHP5 constructor. - * - * @uses wpdb::__construct() Passes parameters and returns result - * @since 0.71 - * - * @param string $dbuser MySQL database user - * @param string $dbpassword MySQL database password - * @param string $dbname MySQL database name - * @param string $dbhost MySQL database host - */ - function wpdb( $dbuser, $dbpassword, $dbname, $dbhost ) { - return $this->__construct( $dbuser, $dbpassword, $dbname, $dbhost ); - } - /** * Connects to the database server and selects a database * @@ -1031,8 +1013,6 @@ class wpdb { * @since 3.0.0 */ function db_connect() { - global $db_list, $global_db_list; - if ( WP_DEBUG ) { $this->dbh = mysql_connect( $this->dbhost, $this->dbuser, $this->dbpassword, true ); } else { @@ -1103,10 +1083,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 @@ -1384,7 +1366,7 @@ class wpdb { // Return an array of row objects with keys from column 1 // (Duplicates are discarded) foreach ( $this->last_result as $row ) { - $key = array_shift( $var_by_ref = get_object_vars( $row ) ); + $key = array_shift( get_object_vars( $row ) ); if ( ! isset( $new_array[ $key ] ) ) $new_array[ $key ] = $row; }