Index: wp-includes/wp-db.php
===================================================================
--- wp-includes/wp-db.php	(revision 12681)
+++ wp-includes/wp-db.php	(working copy)
@@ -64,8 +64,9 @@
 	/**
 	 * Whether to suppress errors during the DB bootstrapping.
 	 *
+	 *
+	 * @since 2.5
 	 * @access private
-	 * @since {@internal Version Unknown}}
 	 * @var bool
 	 */
 	var $suppress_errors = false;
@@ -73,21 +74,44 @@
 	/**
 	 * The last error during query.
 	 *
-	 * @since {@internal Version Unknown}}
-	 * @var string
+	 * FIXME (hakre) access violations on multiple locations in core 
+	 * @see get_last_error()
+	 *
+	 * @since  2.5
+	 * @access private 
+	 * @var    string
 	 */
 	var $last_error = '';
 
 	/**
 	 * Amount of queries made
 	 *
-	 * @since 1.2.0
+	 * @since  1.2.0
 	 * @access private
-	 * @var int
+	 * @var    int
 	 */
 	var $num_queries = 0;
 
 	/**
+	 * Amount of rows returned by last query operation
+	 *
+	 * @since  1.2
+	 * @access private
+	 * @var    int
+	 */
+	var $num_rows = 0; 
+
+	/**
+	 * Number of affected rows by last query operation
+	 *
+	 * @since  0.71
+	 * @access private
+	 * @var    integer
+	 */
+	var $rows_affected = 0;
+
+
+	/**
 	 * Saved result of the last query made
 	 *
 	 * @since 1.2.0
@@ -97,6 +121,18 @@
 	var $last_query;
 
 	/**
+	 * Saved resultset of the last query made
+	 *
+	 * @todo (hakre) get version number
+	 *
+	 * @since  {@internal Version Unknown}
+	 * @access private
+	 * @var    array (null if unintialized)
+	 */
+	var $last_result;
+
+
+	/**
 	 * Saved info on the table column
 	 *
 	 * @since 1.2.0
@@ -135,14 +171,6 @@
 	 * @var bool
 	 */
 	var $ready = false;
-	var $blogid = 0;
-	var $siteid = 0;
-	var $blogs;
-	var $signups;
-	var $site;
-	var $sitemeta;
-	var $sitecategories;
-	var $global_tables = array('blogs', 'signups', 'site', 'sitemeta', 'users', 'usermeta', 'sitecategories', 'registration_log', 'blog_versions');
 
 	/**
 	 * WordPress Posts table
@@ -264,11 +292,13 @@
 	/**
 	 * List of WordPress tables
 	 *
+	 * @todo (hakre) get revision number
+	 *
 	 * @since {@internal Version Unknown}}
 	 * @access private
 	 * @var array
 	 */
-	var $tables = array('posts', 'categories', 'post2cat', 'comments', 'links', 'link2cat', 'options',
+	var $tables = array('users', 'usermeta', 'posts', 'categories', 'post2cat', 'comments', 'links', 'link2cat', 'options',
 			'postmeta', 'terms', 'term_taxonomy', 'term_relationships', 'commentmeta');
 
 	/**
@@ -280,7 +310,6 @@
 	 */
 	var $old_tables = array('categories', 'post2cat', 'link2cat');
 
-
 	/**
 	 * Format specifiers for DB columns. Columns not listed here default to %s.  Initialized in wp-settings.php.
 	 *
@@ -345,8 +374,6 @@
 	 * @param string $dbhost MySQL database host
 	 */
 	function wpdb($dbuser, $dbpassword, $dbname, $dbhost) {
-		if( defined( "WP_USE_MULTIPLE_DB" ) && CONSTANT( "WP_USE_MULTIPLE_DB" ) == true )
-			$this->db_connect();
 		return $this->__construct($dbuser, $dbpassword, $dbname, $dbhost);
 	}
 
@@ -365,20 +392,11 @@
 	 * @param string $dbhost MySQL database host
 	 */
 	function __construct($dbuser, $dbpassword, $dbname, $dbhost) {
-		register_shutdown_function(array(&$this, "__destruct"));
+		register_shutdown_function( array( &$this, "__destruct" ) );
 
 		if ( WP_DEBUG )
 			$this->show_errors();
 
-                if( is_multisite() ) {
-                        $this->charset = 'utf8';
-                        if( defined( 'DB_COLLATE' ) && constant( 'DB_COLLATE' ) != '' ) {
-                                $this->collate = constant( 'DB_COLLATE' );
-                        } else {
-                                $this->collate = 'utf8_general_ci';
-                        }
-                }
-
 		if ( defined('DB_CHARSET') )
 			$this->charset = DB_CHARSET;
 
@@ -387,9 +405,9 @@
 
 		$this->dbuser = $dbuser;
 
-		$this->dbh = @mysql_connect($dbhost, $dbuser, $dbpassword, true);
-		if (!$this->dbh) {
-			$this->bail(sprintf(/*WP_I18N_DB_CONN_ERROR*/"
+		$this->dbh = @mysql_connect( $dbhost, $dbuser, $dbpassword, true );
+		if ( !$this->dbh ) {
+			$this->bail( sprintf( /*WP_I18N_DB_CONN_ERROR*/"
 <h1>Error establishing a database connection</h1>
 <p>This either means that the username and password information in your <code>wp-config.php</code> file is incorrect or we can't contact the database server at <code>%s</code>. This could mean your host's database server is down.</p>
 <ul>
@@ -398,36 +416,50 @@
 	<li>Are you sure that the database server is running?</li>
 </ul>
 <p>If you're unsure what these terms mean you should probably contact your host. If you still need help you can always visit the <a href='http://wordpress.org/support/'>WordPress Support Forums</a>.</p>
-"/*/WP_I18N_DB_CONN_ERROR*/, $dbhost), 'db_connect_fail');
+"/*/WP_I18N_DB_CONN_ERROR*/, $dbhost ), 'db_connect_fail' );
 			return;
 		}
 
 		$this->ready = true;
 
-		if ( $this->has_cap( 'collation' ) && !empty($this->charset) ) {
-			if ( function_exists('mysql_set_charset') ) {
-				mysql_set_charset($this->charset, $this->dbh);
+		if ( $this->has_cap( 'collation' ) && !empty( $this->charset ) ) {
+			if ( function_exists( 'mysql_set_charset' ) ) {
+				mysql_set_charset( $this->charset, $this->dbh );
 				$this->real_escape = true;
 			} else {
-				$collation_query = "SET NAMES '{$this->charset}'";
-				if ( !empty($this->collate) )
-					$collation_query .= " COLLATE '{$this->collate}'";
-				$this->query($collation_query);
+				$query = $this->prepare( 'SET NAMES %s', $this->charset );
+				if ( !empty( $this->collate ) )
+					$query .= $this->prepare( ' COLLATE %s', $this->collate );
+				$this->query( $query );
+				// @todo (hakre) still addslashes; rest disabled for now (430)) there must be a possibility to switch real_escape on here as well!
 			}
 		}
 
-		$this->select($dbname, $this->dbh);
+		$this->select( $dbname, $this->dbh );
 	}
 
 	/**
 	 * PHP5 style destructor and will run when database object is destroyed.
 	 *
+	 * NOTE:
+	 *
+	 *   In difference to the PHP5 behavior of __destruct, this function will 
+	 *   be called when the script shuts down. If the garbage collector will
+	 *   remove this object earlier in PHP5, this function will be called prior to 
+	 *   script termination.
+	 *
+	 *   Please see {@link __construct() class constructor} and the 
+	 *   {@link register_shutdown_function() register_shutdown_function()}. for
+	 *   more details.
+	 *
+	 * @link http://www.php.net/__destruct
+	 * @link http://www.php.net/register_shutdown_function 
+	 *
 	 * @since 2.0.8
 	 *
-	 * @return bool Always true
+	 * @return void
 	 */
 	function __destruct() {
-		return true;
 	}
 
 	/**
@@ -441,66 +473,26 @@
 	 * @param string $prefix Alphanumeric name for the new prefix.
 	 * @return string|WP_Error Old prefix or WP_Error on error
 	 */
-	function set_prefix($prefix) {
+	function set_prefix( $prefix ) {
 
-		if ( preg_match('|[^a-z0-9_]|i', $prefix) )
+		if ( preg_match( '|[^a-z0-9_]|i', $prefix ) )
 			return new WP_Error('invalid_db_prefix', /*WP_I18N_DB_BAD_PREFIX*/'Invalid database prefix'/*/WP_I18N_DB_BAD_PREFIX*/);
 
-                if( is_multisite() ) {
-                        $old_prefix = '';
-                } else {
-                        $old_prefix = $prefix;
-                }
-		if( isset( $this->base_prefix ) )
-			$old_prefix = $this->base_prefix;
-		$this->base_prefix = $prefix;
-		foreach ( $this->global_tables as $table )
-			$this->$table = $prefix . $table;
+		$old_prefix   = $this->prefix;
+		$this->prefix = $prefix;
 
-		if ( defined('VHOST') && empty($this->blogid) )
-			return $old_prefix;
-
-		$this->prefix = $this->get_blog_prefix( $this->blogid );
-
-		foreach ( (array) $this->tables as $table )
+		foreach ( $this->tables as $table )
 			$this->$table = $this->prefix . $table;
 
-		if ( defined('CUSTOM_USER_TABLE') )
+		if ( defined( 'CUSTOM_USER_TABLE' ) )
 			$this->users = CUSTOM_USER_TABLE;
 
-		if ( defined('CUSTOM_USER_META_TABLE') )
+		if ( defined( 'CUSTOM_USER_META_TABLE' ) )
 			$this->usermeta = CUSTOM_USER_META_TABLE;
 
 		return $old_prefix;
 	}
 
-	function set_blog_id($blog_id, $site_id = '') {
-		if ( !empty($site_id) )
-			$this->siteid = $site_id;
-
-		$old_blog_id = $this->blogid;
-		$this->blogid = $blog_id;
-
-		$this->prefix = $this->get_blog_prefix( $this->blogid );
-
-		foreach ( $this->tables as $table )
-			$this->$table = $this->prefix . $table;
-
-		return $old_blog_id;
-	}
-
-	function get_blog_prefix( $blog_id = '' ) {
-		if ( $blog_id ) {
-                        if( defined('MULTISITE') && ( $blog_id == 0 || $blog_id == 1) ) {
-        			return $this->prefix;
-                        } else {
-        			return $this->base_prefix . $blog_id . '_';
-                        }
-		} else {
-			return $this->base_prefix;
-		}
-	}
-
 	/**
 	 * Selects a database using the current database connection.
 	 *
@@ -512,8 +504,8 @@
 	 * @param string $db MySQL database name
 	 * @return null Always null.
 	 */
-	function select($db, &$dbh) {
-		if (!@mysql_select_db($db, $dbh)) {
+	function select($db) {
+		if (!@mysql_select_db($db, $this->dbh)) {
 			$this->ready = false;
 			$this->bail(sprintf(/*WP_I18N_DB_SELECT_DB*/'
 <h1>Can&#8217;t select database</h1>
@@ -528,30 +520,41 @@
 		}
 	}
 
-	function _weak_escape($string) {
-		return addslashes($string);
-	}
-
-	function _real_escape($string) {
+	/**
+	 * real escape
+	 *
+	 * escape via mysql_real_escape_string() or addslashes()  
+	 *
+	 * @since  2.8
+	 * @access private
+	 *
+	 * @param  string $string to escape
+	 * @return string escaped
+	 */
+	function _real_escape( $string ) {
 		if ( $this->dbh && $this->real_escape )
 			return mysql_real_escape_string( $string, $this->dbh );
 		else
 			return addslashes( $string );
 	}
 
-	function _escape($data) {
-		if ( is_array($data) ) {
-			foreach ( (array) $data as $k => $v ) {
-				if ( is_array($v) )
-					$data[$k] = $this->_escape( $v );
-				else
-					$data[$k] = $this->_real_escape( $v );
-			}
-		} else {
-			$data = $this->_real_escape( $data );
-		}
+	/**
+	 * escape
+	 *
+	 * escape data, uses {@see _real_escape()} and works 
+	 * on arrays as well.
+	 *
+	 * @since  2.8
+	 * @access private
+	 * 
+	 * @param  string|array $data to escape
+	 * @return string|array escaped
+	 */
+	function _escape( $data ) {
+		if ( is_array( $data ) )
+			return array_map( array( &$this, '_escape' ), $data );
 
-		return $data;
+		return $this->_real_escape( $data );
 	}
 
 	/**
@@ -559,22 +562,14 @@
 	 *
 	 * @since 0.71
 	 *
-	 * @param string|array $data
-	 * @return string query safe string
+	 * @param  string|array $data to escape
+	 * @return string|array escaped as query safe string
 	 */
-	function escape($data) {
-		if ( is_array($data) ) {
-			foreach ( (array) $data as $k => $v ) {
-				if ( is_array($v) )
-					$data[$k] = $this->escape( $v );
-				else
-					$data[$k] = $this->_weak_escape( $v );
-			}
-		} else {
-			$data = $this->_weak_escape( $data );
-		}
+	function escape( $data ) {
+		if ( is_array($data) )
+			return array_map( array( &$this, 'escape' ), $data );
 
-		return $data;
+		return addslashes( $data );
 	}
 
 	/**
@@ -582,15 +577,27 @@
 	 *
 	 * @since 2.3.0
 	 *
-	 * @param string $s
+	 * @param  string $string to escape
+	 * @return void
 	 */
-	function escape_by_ref(&$string) {
+	function escape_by_ref( &$string ) {
 		$string = $this->_real_escape( $string );
 	}
 
 	/**
 	 * Prepares a SQL query for safe execution.  Uses sprintf()-like syntax.
 	 *
+	 * The following directives can be used in the query format string: 
+	 *
+	 *   %d (decimal number)  
+	 *   %s (string)
+	 *   %% (literal percentage sign - no argument needed) 
+	 *
+	 * Both %d and %s are to be left unquoted in the query string and   
+	 * they need an argument passed for them. 
+	 * Literals (%) as parts of the query must be properly written 
+	 * as %%. 
+	 *  
 	 * This function only supports a small subset of the sprintf syntax; it only supports %d (decimal number), %s (string).
 	 * Does not support sign, padding, alignment, width or precision specifiers.
 	 * Does not support argument numbering/swapping.
@@ -601,29 +608,33 @@
 	 *
 	 * <code>
 	 * wpdb::prepare( "SELECT * FROM `table` WHERE `column` = %s AND `field` = %d", "foo", 1337 )
+	 * wpdb::prepare( "SELECT DATE_FORMAT(`field`, '%%c') FROM `table` WHERE `column` = %s", 'foo' );
 	 * </code>
 	 *
 	 * @link http://php.net/sprintf Description of syntax.
 	 * @since 2.3.0
 	 *
-	 * @param string $query Query statement with sprintf()-like placeholders
-	 * @param array|mixed $args The array of variables to substitute into the query's placeholders if being called like {@link http://php.net/vsprintf vsprintf()}, or the first variable to substitute into the query's placeholders if being called like {@link http://php.net/sprintf sprintf()}.
-	 * @param mixed $args,... further variables to substitute into the query's placeholders if being called like {@link http://php.net/sprintf sprintf()}.
-	 * @return null|string Sanitized query string
+	 * @param  string $query Query statement with sprintf()-like placeholders
+	 * @param  mixed  $args  The array of variables to substitute into the query's placeholders if being called like {@link http://php.net/vsprintf vsprintf()}, or the first variable to substitute into the query's placeholders if being called like {@link http://php.net/sprintf sprintf()}.
+	 * @param  mixed  $args,... further variables to substitute into the query's placeholders if being called like {@link http://php.net/sprintf sprintf()}.
+	 * @return string|false  Sanitized query string, false on error
 	 */
-	function prepare($query = null) { // ( $query, *$args )
+	function prepare( $query = null ) { // ( $query, *$args )
 		if ( is_null( $query ) )
-			return;
+			return false;
+
 		$args = func_get_args();
-		array_shift($args);
-		// If args were passed as an array (as in vsprintf), move them up
-		if ( isset($args[0]) && is_array($args[0]) )
-			$args = $args[0];
-		$query = str_replace("'%s'", '%s', $query); // in case someone mistakenly already singlequoted it
-		$query = str_replace('"%s"', '%s', $query); // doublequote unquoting
-		$query = str_replace('%s', "'%s'", $query); // quote the strings
-		array_walk($args, array(&$this, 'escape_by_ref'));
-		return @vsprintf($query, $args);
+		array_shift( $args );
+
+		if ( isset( $args[0] ) && is_array( $args[0] ) )
+			$args = $args[0]; # re-assign args passed as array like in vsprintf
+
+		// @todo (hakre) $query input can be  better sanitzed, tested code available #11608
+
+		$quoted = str_replace('%s', "'%s'", $query); # quote the strings
+		$quoted = str_replace( array( "''%s''", "\"'%'\"" ), "'%s'", $quoted ); # in case someone mistakenly already single/double quoted it 
+		array_walk( $args, array( &$this, 'escape_by_ref' ) );
+		return @vsprintf( $quoted, $args );
 	}
 
 	/**
@@ -635,7 +646,7 @@
 	 * @param string $str The error to display
 	 * @return bool False if the showing of errors is disabled.
 	 */
-	function print_error($str = '') {
+	function print_error( $str = '' ) {
 		global $EZSQL_ERROR;
 
 		if (!$str) $str = mysql_error($this->dbh);
@@ -649,37 +660,21 @@
 		else
 			$error_str = sprintf(/*WP_I18N_DB_QUERY_ERROR*/'WordPress database error %1$s for query %2$s'/*/WP_I18N_DB_QUERY_ERROR*/, $str, $this->last_query);
 
-		$log_error = true;
-		if ( ! function_exists('error_log') )
-			$log_error = false;
+		trigger_error( $error_str, E_USER_WARNING );
 
-		$log_file = @ini_get('error_log');
-		if ( !empty($log_file) && ('syslog' != $log_file) && !@is_writable($log_file) )
-			$log_error = false;
+		if ( function_exists( 'error_log' )
+		     && !( $log_file = ini_get( 'error_log' ) )
+		     && ( 'syslog' != $log_file )
+		     && @is_writable( $log_file ) ) 
+		    @error_log( $error_str );
 
-		if ( $log_error )
-			@error_log($error_str, 0);
-
 		// Is error output turned on or not..
 		if ( !$this->show_errors )
 			return false;
 
-                // If there is an error then take note of it
-                if( is_multisite() ) {
-                        $msg = "WordPress database error: [$str]\n{$this->last_query}\n";
-                        if( defined( 'ERRORLOGFILE' ) )
-                                error_log( $msg, 3, CONSTANT( 'ERRORLOGFILE' ) );
-                        if( defined( 'DIEONDBERROR' ) )
-                                die( $msg );
-                } else {
-                        $str = htmlspecialchars($str, ENT_QUOTES);
-                        $query = htmlspecialchars($this->last_query, ENT_QUOTES);
-
-                        print "<div id='error'>
-                        <p class='wpdberror'><strong>WordPress database error:</strong> [$str]<br />
-                        <code>$query</code></p>
-                        </div>";
-                }
+		$str   = htmlspecialchars( $str, ENT_QUOTES );
+		$query = $this->last_query ? sprintf( '<br><code>%s</code>', htmlspecialchars( $this->last_query, ENT_QUOTES ) ) : '';
+		printf('<div id="error"><p class="wpdberror"><strong>WordPress database error:</strong> [%s]%s</p>', $str, $query); 
 	}
 
 	/**
@@ -690,9 +685,10 @@
 	 * this function can be used to enable and disable showing of database
 	 * errors.
 	 *
-	 * @since 0.71
-	 *
-	 * @param bool $show Whether to show or hide errors
+	 * @since  0.71
+	 * @see    hide_errors()
+	 * 
+	 * @param  bool $show Whether to show or hide errors
 	 * @return bool Old value for showing errors.
 	 */
 	function show_errors( $show = true ) {
@@ -703,10 +699,13 @@
 
 	/**
 	 * Disables showing of database errors.
+	 * 
+	 * By default database errors are not shown.
 	 *
-	 * @since 0.71
+	 * @since  0.71 
+	 * @see    show_errors()
 	 *
-	 * @return bool Whether showing of errors was active or not
+	 * @return bool Old show errors value
 	 */
 	function hide_errors() {
 		$show = $this->show_errors;
@@ -717,12 +716,17 @@
 	/**
 	 * Whether to suppress database errors.
 	 *
-	 * @param unknown_type $suppress
-	 * @return unknown
+	 * By default database errors are suppressed, with a simple
+	 * call to this function they can be enabled.
+	 *
+	 * @since  2.5
+	 * @see    hide_errors()
+	 * @param  bool $suppress (optional) new value, defaults to true
+	 * @return bool old suppress errors value
 	 */
 	function suppress_errors( $suppress = true ) {
 		$errors = $this->suppress_errors;
-		$this->suppress_errors = $suppress;
+		$this->suppress_errors = (bool) $suppress;
 		return $errors;
 	}
 
@@ -730,49 +734,17 @@
 	 * Kill cached query results.
 	 *
 	 * @since 0.71
+	 *
+	 * @return void
 	 */
 	function flush() {
-		$this->last_result = array();
-		$this->col_info = null;
-		$this->last_query = null;
+		$this->last_result   = array();
+		$this->num_rows      = 0;
+		$this->rows_affected = 0;
+		$this->col_info      = null;
+		$this->last_query    = null;
 	}
 
-	function db_connect( $query = "SELECT" ) {
-		global $db_list, $global_db_list;
-		if( is_array( $db_list ) == false )
-			return true;
-
-		if( $this->blogs != '' && preg_match("/(" . $this->blogs . "|" . $this->users . "|" . $this->usermeta . "|" . $this->site . "|" . $this->sitemeta . "|" . $this->sitecategories . ")/i",$query) ) {
-			$action = 'global';
-			$details = $global_db_list[ mt_rand( 0, count( $global_db_list ) -1 ) ];
-			$this->db_global = $details;
-		} elseif ( preg_match("/^\\s*(alter table|create|insert|delete|update|replace) /i",$query) ) {
-			$action = 'write';
-			$details = $db_list[ 'write' ][ mt_rand( 0, count( $db_list[ 'write' ] ) -1 ) ];
-			$this->db_write = $details;
-		} else {
-			$action = '';
-			$details = $db_list[ 'read' ][ mt_rand( 0, count( $db_list[ 'read' ] ) -1 ) ];
-			$this->db_read = $details;
-		}
-
-		$dbhname = "dbh" . $action;
-		$this->$dbhname = @mysql_connect( $details[ 'db_host' ], $details[ 'db_user' ], $details[ 'db_password' ] );
-		if (!$this->$dbhname ) {
-			$this->bail("
-<h1>Error establishing a database connection</h1>
-<p>This either means that the username and password information in your <code>wp-config.php</code> file is incorrect or we can't contact the database server at <code>$dbhost</code>. This could mean your host's database server is down.</p>
-<ul>
-	<li>Are you sure you have the correct username and password?</li>
-	<li>Are you sure that you have typed the correct hostname?</li>
-	<li>Are you sure that the database server is running?</li>
-</ul>
-<p>If you're unsure what these terms mean you should probably contact your host. If you still need help you can always visit the <a href='http://wordpress.org/support/'>WordPress Support Forums</a>.</p>
-");
-		}
-		$this->select( $details[ 'db_name' ], $this->$dbhname );
-	}
-
 	/**
 	 * Perform a MySQL database query, using current database connection.
 	 *
@@ -780,19 +752,17 @@
 	 *
 	 * @since 0.71
 	 *
-	 * @param string $query
+	 * @param  string   $query database query
 	 * @return int|false Number of rows affected/selected or false on error
 	 */
-	function query($query) {
+	function query( $query ) {
 		if ( ! $this->ready )
 			return false;
 
-		// filter the query, if filters are available
-		// NOTE: some queries are made before the plugins have been loaded, and thus cannot be filtered with this method
 		if ( function_exists('apply_filters') )
 			$query = apply_filters('query', $query);
 
-		// initialise return
+		// init return values and objects state
 		$return_val = 0;
 		$this->flush();
 
@@ -802,76 +772,52 @@
 		// Keep track of the last query for debug..
 		$this->last_query = $query;
 
-		// Perform the query via std mysql_query function..
 		if ( defined('SAVEQUERIES') && SAVEQUERIES )
 			$this->timer_start();
-		
-		// use $this->dbh for read ops, and $this->dbhwrite for write ops
-		// use $this->dbhglobal for gloal table ops
-		unset( $dbh );
-		if( defined( "WP_USE_MULTIPLE_DB" ) && CONSTANT( "WP_USE_MULTIPLE_DB" ) == true ) {
-			if( $this->blogs != '' && preg_match("/(" . $this->blogs . "|" . $this->users . "|" . $this->usermeta . "|" . $this->site . "|" . $this->sitemeta . "|" . $this->sitecategories . ")/i",$query) ) {
-				if( false == isset( $this->dbhglobal ) ) {
-					$this->db_connect( $query );
-				}
-				$dbh =& $this->dbhglobal;
-				$this->last_db_used = "global";
-			} elseif ( preg_match("/^\\s*(alter table|create|insert|delete|update|replace) /i",$query) ) {
-				if( false == isset( $this->dbhwrite ) ) {
-					$this->db_connect( $query );
-				}
-				$dbh =& $this->dbhwrite;
-				$this->last_db_used = "write";
-			} else {
-				$dbh =& $this->dbh;
-				$this->last_db_used = "read";
-			}
-		} else {
-			$dbh =& $this->dbh;
-			$this->last_db_used = "other/read";
-		}
 
-		$this->result = @mysql_query($query, $dbh);
-		++$this->num_queries;
+		// Perform the query via std mysql_query function..
+		$this->result = @mysql_query($query, $this->dbh);
+		$this->num_queries++;
 
 		if ( defined('SAVEQUERIES') && SAVEQUERIES )
 			$this->queries[] = array( $query, $this->timer_stop(), $this->get_caller() );
 
 		// If there is an error then take note of it..
-		if ( $this->last_error = mysql_error($dbh) ) {
+		if ( $this->last_error = mysql_error( $this->dbh ) ) {
 			$this->print_error();
 			return false;
 		}
 
-		if ( preg_match("/^\\s*(insert|delete|update|replace|alter) /i",$query) ) {
-			$this->rows_affected = mysql_affected_rows($dbh);
-			// Take note of the insert_id
-			if ( preg_match("/^\\s*(insert|replace) /i",$query) ) {
-				$this->insert_id = mysql_insert_id($dbh);
-			}
-			// Return number of rows affected
-			$return_val = $this->rows_affected;
-		} else {
-			$i = 0;
-			while ($i < @mysql_num_fields($this->result)) {
-				$this->col_info[$i] = @mysql_fetch_field($this->result);
-				$i++;
-			}
-			$num_rows = 0;
-			while ( $row = @mysql_fetch_object($this->result) ) {
-				$this->last_result[$num_rows] = $row;
-				$num_rows++;
-			}
+		if ( preg_match( '(^\s*([a-z]{2,})\s+)i', $query, $matches ) )
+			$type = strtoupper($matches[1]);
+		else
+			$type = '';
 
-			@mysql_free_result($this->result);
+		switch( $type ) {
+			case 'INSERT':
+			case 'REPLACE':
+				$this->insert_id = mysql_insert_id( $this->dbh );
+			case 'DELETE':
+			case 'UPDATE':
+			case 'ALTER':
+				$this->rows_affected = mysql_affected_rows( $this->dbh );
+				$return_val = $this->rows_affected;
+				break;
 
-			// Log number of rows the query returned
-			$this->num_rows = $num_rows;
+			default:
+				$i = 0;
+				while ( $i < @mysql_num_fields( $this->result ) )
+					$this->col_info[$i++] = @mysql_fetch_field( $this->result );
 
-			// Return number of rows selected
-			$return_val = $this->num_rows;
+				$num_rows = 0;
+				while ( $row = @mysql_fetch_assoc( $this->result ) )
+					$this->last_result[$num_rows++] = $row;
+
+				@mysql_free_result( $this->result );
+				$this->num_rows = $num_rows;
+				$return_val = $num_rows;
 		}
-
+		
 		return $return_val;
 	}
 
@@ -879,81 +825,92 @@
 	 * Insert a row into a table.
 	 *
 	 * <code>
+	 * wpdb::insert( 'table', array( 'column' => 'foo', 'field' => 1337 ) )
 	 * wpdb::insert( 'table', array( 'column' => 'foo', 'field' => 1337 ), array( '%s', '%d' ) )
 	 * </code>
 	 *
 	 * @since 2.5.0
-	 * @see wpdb::prepare()
+	 * @see   prepare()
 	 *
-	 * @param string $table table name
-	 * @param array $data Data to insert (in column => value pairs).  Both $data columns and $data values should be "raw" (neither should be SQL escaped).
-	 * @param array|string $format (optional) An array of formats to be mapped to each of the value in $data.  If string, that format will be used for all of the values in $data.  A format is one of '%d', '%s' (decimal number, string).  If omitted, all values in $data will be treated as strings.
-	 * @return int|false The number of rows inserted, or false on error.
+	 * @param  string       $table  table name
+	 * @param  array        $data   Data to insert (in column => value pairs).  Both $data columns and $data values should be "raw" (neither should be SQL escaped).
+	 * @param  array|string $format (optional) An array of formats to be mapped to each of the value in $data.  If string, that format will be used for all of the values in $data.  A format is one of '%d', '%s' (decimal number, string).  If omitted, all values in $data will be treated as strings.
+	 * @return int|false    The number of rows inserted, or false on error.
 	 */
-	function insert($table, $data, $format = null) {
-		$formats = $format = (array) $format;
-		$fields = array_keys($data);
-		$formatted_fields = array();
-		foreach ( $fields as $field ) {
-			if ( !empty($format) )
-				$form = ( $form = array_shift($formats) ) ? $form : $format[0];
-			elseif ( isset($this->field_types[$field]) )
-				$form = $this->field_types[$field];
-			else
-				$form = '%s';
-			$formatted_fields[] = $form;
-		}
-		$sql = "INSERT INTO `$table` (`" . implode( '`,`', $fields ) . "`) VALUES ('" . implode( "','", $formatted_fields ) . "')";
-		return $this->query( $this->prepare( $sql, $data) );
+	function insert( $table, $data, $format = null ) {
+		if ( !is_array( $data ) )
+			return false;
+
+		$sql = sprintf( 
+			'INSERT INTO `%s` SET %s' 
+			, $table
+			, $this->_field_formats( array_keys( $data ), $format, ', ' )
+		);
+		$values = array_values( $data );
+		return $this->query( $this->prepare( $sql, $values ) );
 	}
 
-
 	/**
 	 * Update a row in the table
 	 *
 	 * <code>
+	 * wpdb::update( 'table', array( 'column' => 'foo', 'field' => 1337 ), array( 'ID' => 1 ) )
 	 * wpdb::update( 'table', array( 'column' => 'foo', 'field' => 1337 ), array( 'ID' => 1 ), array( '%s', '%d' ), array( '%d' ) )
 	 * </code>
 	 *
 	 * @since 2.5.0
-	 * @see wpdb::prepare()
+	 * @see   prepare()
 	 *
-	 * @param string $table table name
-	 * @param array $data Data to update (in column => value pairs).  Both $data columns and $data values should be "raw" (neither should be SQL escaped).
-	 * @param array $where A named array of WHERE clauses (in column => value pairs).  Multiple clauses will be joined with ANDs.  Both $where columns and $where values should be "raw".
-	 * @param array|string $format (optional) An array of formats to be mapped to each of the values in $data.  If string, that format will be used for all of the values in $data.  A format is one of '%d', '%s' (decimal number, string).  If omitted, all values in $data will be treated as strings.
+	 * @param string       $table        table name
+	 * @param array        $data         Data to update (in column => value pairs).  Both $data columns and $data values should be "raw" (neither should be SQL escaped).
+	 * @param array        $where        A named array of WHERE clauses (in column => value pairs).  Multiple clauses will be joined with ANDs.  Both $where columns and $where values should be "raw".
+	 * @param array|string $format       (optional) An array of formats to be mapped to each of the values in $data.  If string, that format will be used for all of the values in $data.  A format is one of '%d', '%s' (decimal number, string).  If omitted, all values in $data will be treated as strings.
 	 * @param array|string $format_where (optional) An array of formats to be mapped to each of the values in $where.  If string, that format will be used for all of  the items in $where.  A format is one of '%d', '%s' (decimal number, string).  If omitted, all values in $where will be treated as strings.
-	 * @return int|false The number of rows updated, or false on error.
+	 * @return int|false   The number of rows updated, or false on error.
 	 */
-	function update($table, $data, $where, $format = null, $where_format = null) {
-		if ( !is_array( $where ) )
+	function update( $table, $data, $where, $format = null, $where_format = null ) {
+		if ( !is_array( $data ) || !is_array( $where ))
 			return false;
 
+		$sql = sprintf(
+			'UPDATE `%s` SET %s WHERE %s'
+			, $table
+			, $this->_field_formats( array_keys( $data  ), $format, ', ' )
+			, $this->_field_formats( array_keys( $where ), $where_format, ' AND ' )
+		);		
+		$values = array_merge( array_values( $data ), array_values( $where ) );
+		return $this->query( $this->prepare( $sql, $values ) );
+	}
+
+	/**
+	 * field types
+	 * 
+	 * helper function to get the format string for 
+	 * multiple fields.
+	 * 
+	 * @param array $fields fields name => value based
+	 * @param array $format additional field-format specifier(s), compare to wpdb::update() $format parameter
+	 * @param string $concat concatination string 
+	 * @param string $default (optional) default format, is %s, see wpdb::prepare() for format tokens 
+	 * @return array string format token string for those fields to be used
+	 * @access private
+	 * @since 3.0
+	 */
+	function _field_formats( $fields, $format, $concat, $default = '%s' ) {
+		$result  = array();
 		$formats = $format = (array) $format;
-		$bits = $wheres = array();
-		foreach ( (array) array_keys($data) as $field ) {
-			if ( !empty($format) )
-				$form = ( $form = array_shift($formats) ) ? $form : $format[0];
-			elseif ( isset($this->field_types[$field]) )
-				$form = $this->field_types[$field];
-			else
-				$form = '%s';
-			$bits[] = "`$field` = {$form}";
-		}
 
-		$where_formats = $where_format = (array) $where_format;
-		foreach ( (array) array_keys($where) as $field ) {
-			if ( !empty($where_format) )
-				$form = ( $form = array_shift($where_formats) ) ? $form : $where_format[0];
-			elseif ( isset($this->field_types[$field]) )
-				$form = $this->field_types[$field];
-			else
-				$form = '%s';
-			$wheres[] = "`$field` = {$form}";
+		foreach ( $fields as $field ) {
+			$token = $default;
+			if ( count( $format ) )
+				$token = ( $token = array_shift($formats) ) ? $token : $format[0];
+			elseif ( isset( $this->field_types[$field] ) )
+				$token = $this->field_types[$field];
+
+			$result[] = sprintf( '`%s` = %s', $field, $token );
 		}
 
-		$sql = "UPDATE `$table` SET " . implode( ', ', $bits ) . ' WHERE ' . implode( ' AND ', $wheres );
-		return $this->query( $this->prepare( $sql, array_merge(array_values($data), array_values($where))) );
+		return implode( $concat, $result );
 	}
 
 	/**
@@ -965,23 +922,23 @@
 	 *
 	 * @since 0.71
 	 *
-	 * @param string|null $query SQL query.  If null, use the result from the previous query.
-	 * @param int $x (optional) Column of value to return.  Indexed from 0.
-	 * @param int $y (optional) Row of value to return.  Indexed from 0.
-	 * @return string Database query result
+	 * @param string       $query (optional) SQL query. Defaults to NULL the re-use of existing data.
+	 * @param int          $col   (optional) Column of value to return.  Indexed from 0.
+	 * @param int          $row   (optional) Row of value to return.  Indexed from 0.
+	 * @return string|null string value on success, NULL if a value on 
 	 */
-	function get_var($query=null, $x = 0, $y = 0) {
-		$this->func_call = "\$db->get_var(\"$query\",$x,$y)";
+	function get_var( $query = null, $col = 0, $row = 0 ) {
+		$this->func_call = "\$db->get_var(\"$query\",$col,$row)";
 		if ( $query )
-			$this->query($query);
+			$this->query( $query );
 
-		// Extract var out of cached results based x,y vals
-		if ( !empty( $this->last_result[$y] ) ) {
-			$values = array_values(get_object_vars($this->last_result[$y]));
+		if ( isset( $this->last_result[$row] )
+		     && ( $values = array_values( $this->last_result[$row] ) )
+		     && isset( $values[$col] ) ) {
+		   	return $values[$col];
 		}
 
-		// If there is a value return it else return null
-		return (isset($values[$x]) && $values[$x]!=='') ? $values[$x] : null;
+		return null;
 	}
 
 	/**
@@ -993,29 +950,62 @@
 	 *
 	 * @param string|null $query SQL query.
 	 * @param string $output (optional) one of ARRAY_A | ARRAY_N | OBJECT constants.  Return an associative array (column => value, ...), a numerically indexed array (0 => value, ...) or an object ( ->column = value ), respectively.
-	 * @param int $y (optional) Row to return.  Indexed from 0.
-	 * @return mixed Database query result in format specifed by $output
+	 * @param int    $row (optional) Row to return.  Indexed from 0.
+	 * @return mixed Database query result in format specifed by $output or NULL
 	 */
-	function get_row($query = null, $output = OBJECT, $y = 0) {
-		$this->func_call = "\$db->get_row(\"$query\",$output,$y)";
-		if ( $query )
-			$this->query($query);
-		else
-			return null;
+	function &get_row( $query = null, $output = OBJECT, $row = 0) {
+		$this->func_call = "\$db->get_row(\"$query\",$output,$row)";
+		$retval = null;
 
-		if ( !isset($this->last_result[$y]) )
-			return null;
+		if ( null !== $query && false === $this->query( $query ) )
+			return $retval;
 
-		if ( $output == OBJECT ) {
-			return $this->last_result[$y] ? $this->last_result[$y] : null;
-		} elseif ( $output == ARRAY_A ) {
-			return $this->last_result[$y] ? get_object_vars($this->last_result[$y]) : null;
-		} elseif ( $output == ARRAY_N ) {
-			return $this->last_result[$y] ? array_values(get_object_vars($this->last_result[$y])) : null;
-		} else {
-			$this->print_error(/*WP_I18N_DB_GETROW_ERROR*/" \$db->get_row(string query, output type, int offset) -- Output type must be one of: OBJECT, ARRAY_A, ARRAY_N"/*/WP_I18N_DB_GETROW_ERROR*/);
+		$row = absint( $row );
+
+		if ( $row >= $this->num_rows )
+			return $retval;
+
+		$retval = $this->last_result[$row]; # stored as ARRAY_A, {@see query()}
+
+		switch ( $output ) {
+			case OBJECT:
+				$retval = (object) $retval;
+			case ARRAY_A:
+				break;
+			case ARRAY_N:
+				$retval = array_values( $retval );
+				break;
+			default:
+				$this->print_error(/*WP_I18N_DB_GETROW_ERROR*/" \$db->get_row(string query, output type, int offset) -- Output type must be one of: OBJECT, ARRAY_A, ARRAY_N"/*/WP_I18N_DB_GETROW_ERROR*/);	
 		}
+		
+		return $retval;
 	}
+	
+	/**
+	 * get last database error
+	 * 
+     * @since 3.0
+     *
+	 * @return string last mysql database error
+	 */
+	function get_last_error() {
+		return $this->last_error;
+	}
+	
+	/**
+	 * get number of rows
+	 * 
+	 * Retrieve the number of rows of the last querty operation
+	 *
+     * @since 3.0 
+	 * @see   query()
+     *
+	 * @return int number of rows
+	 */
+	function get_num_rows() {
+		return $this->num_rows;
+	}
 
 	/**
 	 * Retrieve one column from the database.
@@ -1026,19 +1016,24 @@
 	 *
 	 * @since 0.71
 	 *
-	 * @param string|null $query SQL query.  If null, use the result from the previous query.
-	 * @param int $x Column to return.  Indexed from 0.
-	 * @return array Database query result.  Array indexed from 0 by SQL result row number.
+	 * @param  string $query (optional) SQL query. If omitted it uses the result from the previous query.
+	 * @param  int    $col   (optional) Column to return. Indexed from 0, defaults to first column.
+	 * @return array  Array  Zero-based-row-number-keyed containing the column's value(s)
 	 */
-	function get_col($query = null , $x = 0) {
+	function get_col( $query = null , $col = 0 ) {
 		if ( $query )
-			$this->query($query);
+			$this->query( $query );
 
 		$new_array = array();
-		// Extract the column values
-		for ( $i=0; $i < count($this->last_result); $i++ ) {
-			$new_array[$i] = $this->get_var(null, $x, $i);
-		}
+
+		// get that column values of all rows
+		$count = $this->num_rows;
+		for ( $i = 0; $i < $count; $i++ ) 
+			if ( isset( $this->last_result[$i] )
+		         && $values = array_values( $this->last_result[$i] )
+		         && isset( $values[$col] ) )
+		   		$new_array[$i] = $values[$col];
+
 		return $new_array;
 	}
 
@@ -1046,50 +1041,56 @@
 	 * Retrieve an entire SQL result set from the database (i.e., many rows)
 	 *
 	 * Executes a SQL query and returns the entire SQL result.
+	 * 
+	 * Return Types:
+	 * 
+	 *   ARRAY_A  : array of column name-keyed row arrays
+	 *   ARRAY_N  : array of integer-keyed row arrays
+	 *   OBJECT   : array of row objects
+	 *   OBJECT_K : column-1-keyed array of row objects (duplicates are discarded)
 	 *
 	 * @since 0.71
 	 *
 	 * @param string $query SQL query.
 	 * @param string $output (optional) ane of ARRAY_A | ARRAY_N | OBJECT | OBJECT_K constants.  With one of the first three, return an array of rows indexed from 0 by SQL result row number.  Each row is an associative array (column => value, ...), a numerically indexed array (0 => value, ...), or an object. ( ->column = value ), respectively.  With OBJECT_K, return an associative array of row objects keyed by the value of each row's first column's value.  Duplicate keys are discarded.
-	 * @return mixed Database query results
+	 * @return array|object|null Database query results or NULL on error
 	 */
-	function get_results($query = null, $output = OBJECT) {
+	function &get_results( $query = null, $output = OBJECT ) {
 		$this->func_call = "\$db->get_results(\"$query\", $output)";
-
+		$retval = null;
+		
 		if ( $query )
-			$this->query($query);
+			$this->query( $query );
 		else
-			return null;
+			return $retval;
 
-		if ( $output == OBJECT ) {
-			// Return an integer-keyed array of row objects
-			return $this->last_result;
-		} elseif ( $output == OBJECT_K ) {
-			// Return an array of row objects with keys from column 1
-			// (Duplicates are discarded)
-			foreach ( $this->last_result as $row ) {
-				$key = array_shift( get_object_vars( $row ) );
-				if ( !isset( $new_array[ $key ] ) )
-					$new_array[ $key ] = $row;
-			}
-			return $new_array;
-		} elseif ( $output == ARRAY_A || $output == ARRAY_N ) {
-			// Return an integer-keyed array of...
-			if ( $this->last_result ) {
-				$i = 0;
-				foreach( (array) $this->last_result as $row ) {
-					if ( $output == ARRAY_N ) {
-						// ...integer-keyed row arrays
-						$new_array[$i] = array_values( get_object_vars( $row ) );
-					} else {
-						// ...column name-keyed row arrays
-						$new_array[$i] = get_object_vars( $row );
-					}
-					++$i;
-				}
-				return $new_array;
-			}
+		$retval = $this->last_result; # Array of database rows, each of type ARRAY_A {@see query()}
+
+		switch ( $output ) {
+			case OBJECT:   # array of row objects
+				foreach ( $retval as $key => $value )
+					$retval[$key] = (object) $value;
+				break;
+
+			case OBJECT_K: # column-1-keyed array of row objects (duplicates are discarded)
+				$retval = array();
+				foreach ($this->last_result as $value )
+					if ( !isset( $retval[$key = array_shift( array_values( $value ) )] ) )
+						$retval[$key] = (object) $value;
+				break;
+
+			case ARRAY_N:  # array of integer-keyed row arrays
+				foreach ( $retval as $key=> $value )
+					$retval[$key] = array_values( $value );
+
+			case ARRAY_A:  # array of column name-keyed row arrays
+				break;
+
+			default:       # undefined return type
+				$retval = null;
 		}
+
+		return $retval;
 	}
 
 	/**
@@ -1172,6 +1173,7 @@
 	 *
 	 * @since 2.5.0
 	 * @uses $wp_version
+	 * @uses $required_mysql_version
 	 *
 	 * @return WP_Error
 	 */
@@ -1197,23 +1199,47 @@
 	}
 
 	/**
-	 * Generic function to determine if a database supports a particular feature
-	 * @param string $db_cap the feature
-	 * @param false|string|resource $dbh_or_table (not implemented) Which database to test.  False = the currently selected database, string = the database containing the specified table, resource = the database corresponding to the specified mysql resource.
+	 * has capability
+	 *
+	 * Determine if a database supports a particular feature
+	 *
+	 * Features are (since version):
+     *
+     *   'collation'     2.5.0
+     *   'group_concat'  2.7
+     *   'subqueries'    2.7
+     *
+	 * ADDITIONAL PARAMETER NOTICE
+	 * 
+	 * there once was a proposed second parameter which has never been 
+	 * implemented. It was describben as "Which database to test" ($dbh_or_table)
+	 *  
+	 * It would have had three different types:
+	 * 
+	 * 	false    : currently selected database
+	 *  string   : database containing this table
+	 *  resource : database by mysql resource
+	 *  
+	 * regarding that third parameter please see {@see db_version()} as well
+	 * 
+	 * @since  2.7
+	 * @see    db_version()
+	 * 
+	 * @param  string $db_cap the feature
 	 * @return bool
 	 */
 	function has_cap( $db_cap ) {
-		$version = $this->db_version();
+		$db_cap = strtolower( $db_cap );
 
-		switch ( strtolower( $db_cap ) ) :
-		case 'collation' :    // @since 2.5.0
-		case 'group_concat' : // @since 2.7
-		case 'subqueries' :   // @since 2.7
-			return version_compare($version, '4.1', '>=');
-			break;
-		endswitch;
-
-		return false;
+		switch ( $db_cap ) {
+			case 'collation' :    # @since 2.5.0
+			case 'group_concat' : # @since 2.7
+			case 'subqueries' :   # @since 2.7
+				$version = $this->db_version();
+				return version_compare( $version, '4.1', '>=' );
+			default:
+				return false;
+		}
 	}
 
 	/**
@@ -1227,35 +1253,82 @@
 	 * @return string The name of the calling function
 	 */
 	function get_caller() {
-		// requires PHP 4.3+
-		if ( !is_callable('debug_backtrace') )
-			return '';
-
-		$bt = debug_backtrace();
+		$trace  = array_reverse( debug_backtrace() );
 		$caller = array();
 
-		$bt = array_reverse( $bt );
-		foreach ( (array) $bt as $call ) {
-			if ( @$call['class'] == __CLASS__ )
-				continue;
+		foreach ( $trace as $call ) {
+			if ( isset( $call['class'] ) &&  __CLASS__ == $call['class'] )
+				continue; # filter out function calls if this object's class
+
 			$function = $call['function'];
+
 			if ( isset( $call['class'] ) )
 				$function = $call['class'] . "->$function";
+
 			$caller[] = $function;
 		}
-		$caller = join( ', ', $caller );
 
-		return $caller;
+		return join( ', ', $caller );
 	}
 
 	/**
-	 * The database version number
-	 * @param false|string|resource $dbh_or_table (not implemented) Which database to test.  False = the currently selected database, string = the database containing the specified table, resource = the database corresponding to the specified mysql resource.
+	 * get database version number
+	 *
+	 * ADDITIONAL PARAMETER NOTICE
+	 *
+	 * there once was a proposed second parameter which has never been 
+	 * implemented. It was describben as "Which database to test" ($dbh_or_table)
+	 *
+	 * It would have had three different types:
+	 *
+	 * 	false    : currently selected database
+	 *  string   : database containing this table
+	 *  resource : database by mysql resource
+	 *
+	 * regarding that third parameter please see {@see db_version()} as well 
+	 * 
+	 * @since  2.7
+	 * @see    has_cap()
+	 *
 	 * @return false|string false on failure, version number on success
 	 */
 	function db_version() {
 		return preg_replace('/[^0-9.].*/', '', mysql_get_server_info( $this->dbh ));
 	}
+	
+	/**
+	 * get tables
+	 *
+	 * get list of a set of tables
+	 *
+	 * Sets:
+	 *
+	 *   all     : all names
+	 *   current : active tables
+	 *   old     : deprecated tables 
+	 *
+	 * @since  3.0
+	 *
+	 * @param  string $set (optional) 'all', 'current' or 'old'. defaults to 'current'
+	 * @return array  list of old table names (w/o prefix), false on error
+	 */
+	function get_tables( $set = 'current' ) {
+		$tables = false;
+
+		switch ( $set ) {
+			case 'all':
+				$tables = $this->tables;
+				break;
+			case 'current':
+				$tables = array_diff( $this->tables, $this->old_tables );
+				break;
+			case 'old':
+				$tables = $this->old_tables;
+				break;
+		}
+
+		return $tables;
+	}
 }
 
 if ( ! isset($wpdb) ) {
@@ -1266,4 +1339,4 @@
 	 */
 	$wpdb = new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
 }
-?>
+?>
\ No newline at end of file
