Index: wp-includes/wp-db.php
===================================================================
--- wp-includes/wp-db.php	(revision 17501)
+++ wp-includes/wp-db.php	(working copy)
@@ -35,13 +35,44 @@
 define( 'ARRAY_N', 'ARRAY_N' );
 
 /**
+ * WordPress Database Access Abstraction Object Methods
+ *
+ * @package WordPress
+ * @subpackage Database
+ * @since 3.2
+ */
+Interface WP_Db_Methods {
+	public function set_prefix( $prefix, $set_table_names = true );
+	public function set_blog_id( $blog_id, $site_id = 0 );
+	public function get_blog_prefix( $blog_id = null );
+	public function tables( $scope = 'all', $prefix = true, $blog_id = 0 );
+	public function escape( $data );
+	public function escape_by_ref( &$string );
+	public function prepare( $query = null );
+	public function show_errors( $show = true );
+	public function hide_errors();
+	public function suppress_errors( $suppress = true );
+	public function query( $query );
+	public function insert( $table, $data, $format = null );
+	public function replace( $table, $data, $format = null );
+	public function update( $table, $data, $where, $format = null, $where_format = null );
+	public function get_var( $query = null, $column = 0, $row = 0 );
+	public function get_row( $query = null, $output = null, $row = 0 );
+	public function get_col( $query = null , $column = 0 );
+	public function get_results( $query = null, $output = null );
+	public function get_col_info( $info_type = 'name', $col_offset = null );
+	public function has_cap( $feature );
+	public function db_version();
+}
+
+
+/**
  * WordPress Database Access Abstraction Object
  *
  * 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 with your class. You can not name it wpdb, because this 
+ * file will be included.
  *
  * @link http://codex.wordpress.org/Function_Reference/wpdb_Class
  *
@@ -49,7 +80,11 @@
  * @subpackage Database
  * @since 0.71
  */
-class wpdb {
+class wpdb implements WP_Db_Methods {
+	
+	/*
+	 * private variables {@todo two execptions: $prefix and $base_prefix}}
+	 */
 
 	/**
 	 * Whether to show SQL/DB errors
@@ -58,7 +93,7 @@
 	 * @access private
 	 * @var bool
 	 */
-	var $show_errors = false;
+	private $show_errors = false;
 
 	/**
 	 * Whether to suppress errors during the DB bootstrapping.
@@ -67,7 +102,7 @@
 	 * @since 2.5.0
 	 * @var bool
 	 */
-	var $suppress_errors = false;
+	private $suppress_errors = false;
 
 	/**
 	 * The last error during query.
@@ -77,7 +112,7 @@
 	 * @access private
 	 * @var string
 	 */
-	var $last_error = '';
+	private $last_error = '';
 
 	/**
 	 * Amount of queries made
@@ -86,7 +121,7 @@
 	 * @access private
 	 * @var int
 	 */
-	var $num_queries = 0;
+	private $num_queries = 0;
 
 	/**
 	 * Count of rows returned by previous query
@@ -95,7 +130,7 @@
 	 * @access private
 	 * @var int
 	 */
-	var $num_rows = 0;
+	private $num_rows = 0;
 
 	/**
 	 * Count of affected rows by previous query
@@ -104,25 +139,16 @@
 	 * @access private
 	 * @var int
 	 */
-	var $rows_affected = 0;
+	private $rows_affected = 0;
 
 	/**
-	 * The ID generated for an AUTO_INCREMENT column by the previous query (usually INSERT).
-	 *
-	 * @since 0.71
-	 * @access public
-	 * @var int
-	 */
-	var $insert_id = 0;
-
-	/**
 	 * Saved result of the last query made
 	 *
 	 * @since 1.2.0
 	 * @access private
 	 * @var array
 	 */
-	var $last_query;
+	private $last_query;
 
 	/**
 	 * Results of the last query made
@@ -131,7 +157,7 @@
 	 * @access private
 	 * @var array|null
 	 */
-	var $last_result;
+	private $last_result;
 
 	/**
 	 * Saved info on the table column
@@ -140,7 +166,7 @@
 	 * @access private
 	 * @var array
 	 */
-	var $col_info;
+	private $col_info;
 
 	/**
 	 * Saved queries that were executed
@@ -149,20 +175,33 @@
 	 * @access private
 	 * @var array
 	 */
-	var $queries;
+	private $queries;
 
 	/**
+	 * Timer start value, for debugging purposes.
+	 *
+	 * @since 1.5.0
+	 * @access private
+	 * @var float
+	 * @see timer_stop()
+	 * @see timer_start()
+	 */
+	private $time_start;
+
+	/**
 	 * WordPress table prefix
 	 *
 	 * You can set this to have multiple WordPress installations
 	 * in a single database. The second reason is for possible
 	 * security precautions.
 	 *
+	 * @todo see Ticket #16756 {@link http://core.trac.wordpress.org/attachment/ticket/16756}}
+	 *
 	 * @since 0.71
 	 * @access private
 	 * @var string
 	 */
-	var $prefix = '';
+	public $prefix = '';
 
 	/**
 	 * Whether the database queries are ready to start executing.
@@ -171,27 +210,9 @@
 	 * @access private
 	 * @var bool
 	 */
-	var $ready = false;
+	private $ready = false;
 
 	/**
-	 * {@internal Missing Description}}
-	 *
-	 * @since 3.0.0
-	 * @access public
-	 * @var int
-	 */
-	var $blogid = 0;
-
-	/**
-	 * {@internal Missing Description}}
-	 *
-	 * @since 3.0.0
-	 * @access public
-	 * @var int
-	 */
-	var $siteid = 0;
-
-	/**
 	 * List of WordPress per-blog tables
 	 *
 	 * @since 2.5.0
@@ -199,7 +220,7 @@
 	 * @see wpdb::tables()
 	 * @var array
 	 */
-	var $tables = array( 'posts', 'comments', 'links', 'options', 'postmeta',
+	private $tables = array( 'posts', 'comments', 'links', 'options', 'postmeta',
 		'terms', 'term_taxonomy', 'term_relationships', 'commentmeta' );
 
 	/**
@@ -212,7 +233,7 @@
 	 * @see wpdb::tables()
 	 * @var array
 	 */
-	var $old_tables = array( 'categories', 'post2cat', 'link2cat' );
+	private $old_tables = array( 'categories', 'post2cat', 'link2cat' );
 
 	/**
 	 * List of WordPress global tables
@@ -222,7 +243,7 @@
 	 * @see wpdb::tables()
 	 * @var array
 	 */
-	var $global_tables = array( 'users', 'usermeta' );
+	private $global_tables = array( 'users', 'usermeta' );
 
 	/**
 	 * List of Multisite global tables
@@ -232,17 +253,57 @@
 	 * @see wpdb::tables()
 	 * @var array
 	 */
-	var $ms_global_tables = array( 'blogs', 'signups', 'site', 'sitemeta',
+	private $ms_global_tables = array( 'blogs', 'signups', 'site', 'sitemeta',
 		'sitecategories', 'registration_log', 'blog_versions' );
 
 	/**
+	 * Database Username
+	 *
+	 * @since 2.9.0
+	 * @access private
+	 * @var string
+	 */
+	private $dbuser;
+
+	/*
+	 * public variables
+	 */
+
+	/**
+	 * The ID generated for an AUTO_INCREMENT column by the previous query (usually INSERT).
+	 *
+	 * @since 0.71
+	 * @access public
+	 * @var int
+	 */
+	public $insert_id = 0;
+
+	/**
+	 * {@internal Missing Description}}
+	 *
+	 * @since 3.0.0
+	 * @access public
+	 * @var int
+	 */
+	public $blogid = 0;
+
+	/**
+	 * {@internal Missing Description}}
+	 *
+	 * @since 3.0.0
+	 * @access public
+	 * @var int
+	 */
+	public $siteid = 0;
+
+	/**
 	 * WordPress Comments table
 	 *
 	 * @since 1.5.0
 	 * @access public
 	 * @var string
 	 */
-	var $comments;
+	public $comments;
 
 	/**
 	 * WordPress Comment Metadata table
@@ -251,7 +312,7 @@
 	 * @access public
 	 * @var string
 	 */
-	var $commentmeta;
+	public $commentmeta;
 
 	/**
 	 * WordPress Links table
@@ -260,7 +321,7 @@
 	 * @access public
 	 * @var string
 	 */
-	var $links;
+	public $links;
 
 	/**
 	 * WordPress Options table
@@ -269,7 +330,7 @@
 	 * @access public
 	 * @var string
 	 */
-	var $options;
+	public $options;
 
 	/**
 	 * WordPress Post Metadata table
@@ -278,7 +339,7 @@
 	 * @access public
 	 * @var string
 	 */
-	var $postmeta;
+	public $postmeta;
 
 	/**
 	 * WordPress Posts table
@@ -287,7 +348,7 @@
 	 * @access public
 	 * @var string
 	 */
-	var $posts;
+	public $posts;
 
 	/**
 	 * WordPress Terms table
@@ -296,7 +357,7 @@
 	 * @access public
 	 * @var string
 	 */
-	var $terms;
+	public $terms;
 
 	/**
 	 * WordPress Term Relationships table
@@ -305,7 +366,7 @@
 	 * @access public
 	 * @var string
 	 */
-	var $term_relationships;
+	public $term_relationships;
 
 	/**
 	 * WordPress Term Taxonomy table
@@ -314,7 +375,7 @@
 	 * @access public
 	 * @var string
 	 */
-	var $term_taxonomy;
+	public $term_taxonomy;
 
 	/*
 	 * Global and Multisite tables
@@ -327,7 +388,7 @@
 	 * @access public
 	 * @var string
 	 */
-	var $usermeta;
+	public $usermeta;
 
 	/**
 	 * WordPress Users table
@@ -336,7 +397,7 @@
 	 * @access public
 	 * @var string
 	 */
-	var $users;
+	public $users;
 
 	/**
 	 * Multisite Blogs table
@@ -345,7 +406,7 @@
 	 * @access public
 	 * @var string
 	 */
-	var $blogs;
+	public $blogs;
 
 	/**
 	 * Multisite Blog Versions table
@@ -354,7 +415,7 @@
 	 * @access public
 	 * @var string
 	 */
-	var $blog_versions;
+	public $blog_versions;
 
 	/**
 	 * Multisite Registration Log table
@@ -363,7 +424,7 @@
 	 * @access public
 	 * @var string
 	 */
-	var $registration_log;
+	public $registration_log;
 
 	/**
 	 * Multisite Signups table
@@ -372,7 +433,7 @@
 	 * @access public
 	 * @var string
 	 */
-	var $signups;
+	public $signups;
 
 	/**
 	 * Multisite Sites table
@@ -381,7 +442,7 @@
 	 * @access public
 	 * @var string
 	 */
-	var $site;
+	public $site;
 
 	/**
 	 * Multisite Sitewide Terms table
@@ -390,7 +451,7 @@
 	 * @access public
 	 * @var string
 	 */
-	var $sitecategories;
+	public $sitecategories;
 
 	/**
 	 * Multisite Site Metadata table
@@ -399,7 +460,7 @@
 	 * @access public
 	 * @var string
 	 */
-	var $sitemeta;
+	public $sitemeta;
 
 	/**
 	 * Format specifiers for DB columns. Columns not listed here default to %s. Initialized during WP load.
@@ -414,7 +475,7 @@
 	 * @access public
 	 * @var array
 	 */
-	var $field_types = array();
+	public $field_types = array();
 
 	/**
 	 * Database table columns charset
@@ -423,7 +484,7 @@
 	 * @access public
 	 * @var string
 	 */
-	var $charset;
+	public $charset;
 
 	/**
 	 * Database table columns collate
@@ -432,7 +493,7 @@
 	 * @access public
 	 * @var string
 	 */
-	var $collate;
+	public $collate;
 
 	/**
 	 * Whether to use mysql_real_escape_string
@@ -441,48 +502,21 @@
 	 * @access public
 	 * @var bool
 	 */
-	var $real_escape = false;
+	public $real_escape = false;
 
 	/**
-	 * Database Username
-	 *
-	 * @since 2.9.0
-	 * @access private
-	 * @var string
-	 */
-	var $dbuser;
-
-	/**
 	 * A textual description of the last query/get_row/get_var call
 	 *
 	 * @since 3.0.0
 	 * @access public
 	 * @var string
 	 */
-	var $func_call;
+	public $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
-	 *
-	 * PHP5 style constructor for compatibility with PHP5. Does
-	 * the actual setting up of the class properties and connection
+	 * The actual setting up of the class properties and connection
 	 * to the database.
 	 *
 	 * @link http://core.trac.wordpress.org/ticket/3354
@@ -493,12 +527,9 @@
 	 * @param string $dbname MySQL database name
 	 * @param string $dbhost MySQL database host
 	 */
-	function __construct( $dbuser, $dbpassword, $dbname, $dbhost ) {
-		register_shutdown_function( array( &$this, '__destruct' ) );
+	public function __construct( $dbuser, $dbpassword, $dbname, $dbhost ) {
+		register_shutdown_function( array( $this, '__destruct' ) );
 
-		if ( WP_DEBUG )
-			$this->show_errors();
-
 		$this->init_charset();
 
 		$this->dbuser = $dbuser;
@@ -510,13 +541,15 @@
 	}
 
 	/**
-	 * PHP5 style destructor and will run when database object is destroyed.
+	 * Destructor that will run when database object is destroyed.
 	 *
+	 * Callback of register_shutdown_function
+	 *
 	 * @see wpdb::__construct()
 	 * @since 2.0.8
 	 * @return bool true
 	 */
-	function __destruct() {
+	public function __destruct() {
 		return true;
 	}
 
@@ -525,7 +558,7 @@
 	 *
 	 * @since 3.1.0
 	 */
-	function init_charset() {
+	private function init_charset() {
 		if ( function_exists('is_multisite') && is_multisite() ) {
 			$this->charset = 'utf8';
 			if ( defined( 'DB_COLLATE' ) && DB_COLLATE )
@@ -549,7 +582,7 @@
 	 * @param string   $charset The character set (optional)
 	 * @param string   $collate The collation (optional)
 	 */
-	function set_charset($dbh, $charset = null, $collate = null) {
+	private function set_charset($dbh, $charset = null, $collate = null) {
 		if ( !isset($charset) )
 			$charset = $this->charset;
 		if ( !isset($collate) )
@@ -575,7 +608,7 @@
 	 * @param string $prefix Alphanumeric name for the new prefix.
 	 * @return string|WP_Error Old prefix or WP_Error on error
 	 */
-	function set_prefix( $prefix, $set_table_names = true ) {
+	public function set_prefix( $prefix, $set_table_names = true ) {
 
 		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*/);
@@ -614,7 +647,7 @@
 	 * @param int $site_id Optional.
 	 * @return string previous blog id
 	 */
-	function set_blog_id( $blog_id, $site_id = 0 ) {
+	public function set_blog_id( $blog_id, $site_id = 0 ) {
 		if ( ! empty( $site_id ) )
 			$this->siteid = $site_id;
 
@@ -640,7 +673,7 @@
 	 * @param int $blog_id Optional.
 	 * @return string Blog prefix.
 	 */
-	function get_blog_prefix( $blog_id = null ) {
+	public function get_blog_prefix( $blog_id = null ) {
 		if ( is_multisite() ) {
 			if ( null === $blog_id )
 				$blog_id = $this->blogid;
@@ -681,7 +714,7 @@
 	 * @param int $blog_id Optional. The blog_id to prefix. Defaults to wpdb::$blogid. Used only when prefix is requested.
 	 * @return array Table names. When a prefix is requested, the key is the unprefixed table name.
 	 */
-	function tables( $scope = 'all', $prefix = true, $blog_id = 0 ) {
+	public function tables( $scope = 'all', $prefix = true, $blog_id = 0 ) {
 		switch ( $scope ) {
 			case 'all' :
 				$tables = array_merge( $this->global_tables, $this->tables );
@@ -743,7 +776,7 @@
 	 * @param resource $dbh Optional link identifier.
 	 * @return null Always null.
 	 */
-	function select( $db, $dbh = null) {
+	private function select( $db, $dbh = null) {
 		if ( is_null($dbh) )
 			$dbh = $this->dbh;
 
@@ -771,7 +804,7 @@
 	 * @param string $string
 	 * @return string
 	 */
-	function _weak_escape( $string ) {
+	private function _weak_escape( $string ) {
 		return addslashes( $string );
 	}
 
@@ -786,7 +819,7 @@
 	 * @param  string $string to escape
 	 * @return string escaped
 	 */
-	function _real_escape( $string ) {
+	private function _real_escape( $string ) {
 		if ( $this->dbh && $this->real_escape )
 			return mysql_real_escape_string( $string, $this->dbh );
 		else
@@ -804,7 +837,7 @@
 	 * @param  string|array $data
 	 * @return string|array escaped
 	 */
-	function _escape( $data ) {
+	private function _escape( $data ) {
 		if ( is_array( $data ) ) {
 			foreach ( (array) $data as $k => $v ) {
 				if ( is_array($v) )
@@ -828,7 +861,7 @@
 	 * @param string|array $data to escape
 	 * @return string|array escaped as query safe string
 	 */
-	function escape( $data ) {
+	public function escape( $data ) {
 		if ( is_array( $data ) ) {
 			foreach ( (array) $data as $k => $v ) {
 				if ( is_array( $v ) )
@@ -851,7 +884,7 @@
 	 * @param string $string to escape
 	 * @return void
 	 */
-	function escape_by_ref( &$string ) {
+	public function escape_by_ref( &$string ) {
 		$string = $this->_real_escape( $string );
 	}
 
@@ -891,7 +924,7 @@
 	 * @return null|false|string Sanitized query string, null if there is no query, false if there is an error and string
 	 * 	if there was something to prepare
 	 */
-	function prepare( $query = null ) { // ( $query, *$args )
+	public function prepare( $query = null ) { // ( $query, *$args )
 		if ( is_null( $query ) )
 			return;
 
@@ -916,7 +949,7 @@
 	 * @param string $str The error to display
 	 * @return bool False if the showing of errors is disabled.
 	 */
-	function print_error( $str = '' ) {
+	private function print_error( $str = '' ) {
 		global $EZSQL_ERROR;
 
 		if ( !$str )
@@ -973,7 +1006,7 @@
 	 * @param bool $show Whether to show or hide errors
 	 * @return bool Old value for showing errors.
 	 */
-	function show_errors( $show = true ) {
+	public function show_errors( $show = true ) {
 		$errors = $this->show_errors;
 		$this->show_errors = $show;
 		return $errors;
@@ -989,7 +1022,7 @@
 	 *
 	 * @return bool Whether showing of errors was active
 	 */
-	function hide_errors() {
+	public function hide_errors() {
 		$show = $this->show_errors;
 		$this->show_errors = false;
 		return $show;
@@ -1006,7 +1039,7 @@
 	 * @param bool $suppress Optional. New value. Defaults to true.
 	 * @return bool Old value
 	 */
-	function suppress_errors( $suppress = true ) {
+	public function suppress_errors( $suppress = true ) {
 		$errors = $this->suppress_errors;
 		$this->suppress_errors = (bool) $suppress;
 		return $errors;
@@ -1018,7 +1051,7 @@
 	 * @since 0.71
 	 * @return void
 	 */
-	function flush() {
+	private function flush() {
 		$this->last_result = array();
 		$this->col_info    = null;
 		$this->last_query  = null;
@@ -1029,9 +1062,7 @@
 	 *
 	 * @since 3.0.0
 	 */
-	function db_connect() {
-		global $db_list, $global_db_list;
-
+	private function db_connect() {
 		if ( WP_DEBUG ) {
 			$this->dbh = mysql_connect( $this->dbhost, $this->dbuser, $this->dbpassword, true );
 		} else {
@@ -1075,7 +1106,7 @@
 	 * @param string $query Database query
 	 * @return int|false Number of rows affected/selected or false on error
 	 */
-	function query( $query ) {
+	public function query( $query ) {
 		if ( ! $this->ready )
 			return false;
 
@@ -1157,7 +1188,7 @@
 	 * 	A format is one of '%d', '%s' (decimal number, string). If omitted, all values in $data will be treated as strings unless otherwise specified in wpdb::$field_types.
 	 * @return int|false The number of rows inserted, or false on error.
 	 */
-	function insert( $table, $data, $format = null ) {
+	public function insert( $table, $data, $format = null ) {
 		return $this->_insert_replace_helper( $table, $data, $format, 'INSERT' );
 	}
 
@@ -1180,7 +1211,7 @@
 	 * 	A format is one of '%d', '%s' (decimal number, string). If omitted, all values in $data will be treated as strings unless otherwise specified in wpdb::$field_types.
 	 * @return int|false The number of rows affected, or false on error.
 	 */
-	function replace( $table, $data, $format = null ) {
+	public function replace( $table, $data, $format = null ) {
 		return $this->_insert_replace_helper( $table, $data, $format, 'REPLACE' );
 	}
 
@@ -1201,7 +1232,7 @@
 	 * 	A format is one of '%d', '%s' (decimal number, string). If omitted, all values in $data will be treated as strings unless otherwise specified in wpdb::$field_types.
 	 * @return int|false The number of rows affected, or false on error.
 	 */
-	function _insert_replace_helper( $table, $data, $format = null, $type = 'INSERT' ) {
+	private function _insert_replace_helper( $table, $data, $format = null, $type = 'INSERT' ) {
 		if ( ! in_array( strtoupper( $type ), array( 'REPLACE', 'INSERT' ) ) )
 			return false;
 		$formats = $format = (array) $format;
@@ -1241,7 +1272,7 @@
 	 * @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.
 	 */
-	function update( $table, $data, $where, $format = null, $where_format = null ) {
+	public function update( $table, $data, $where, $format = null, $where_format = null ) {
 		if ( ! is_array( $data ) || ! is_array( $where ) )
 			return false;
 
@@ -1282,22 +1313,22 @@
 	 * @since 0.71
 	 *
 	 * @param string|null $query Optional. SQL query. Defaults to 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.
+	 * @param int $column Optional. Column of value to return.  Indexed from 0.
+	 * @param int $row Optional. Row of value to return.  Indexed from 0.
 	 * @return string|null Database query result (as string), or null on failure
 	 */
-	function get_var( $query = null, $x = 0, $y = 0 ) {
-		$this->func_call = "\$db->get_var(\"$query\", $x, $y)";
+	public function get_var( $query = null, $column = 0, $row = 0 ) {
+		$this->func_call = "\$db->get_var(\"$query\", $column, $row)";
 		if ( $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 ( !empty( $this->last_result[$row] ) ) {
+			$values = array_values( get_object_vars( $this->last_result[$row] ) );
 		}
 
 		// If there is a value return it else return null
-		return ( isset( $values[$x] ) && $values[$x] !== '' ) ? $values[$x] : null;
+		return ( isset( $values[$column] ) && $values[$column] !== '' ) ? $values[$column] : null;
 	}
 
 	/**
@@ -1310,25 +1341,25 @@
 	 * @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.
+	 * @param int $row Optional. Row to return. Indexed from 0.
 	 * @return mixed Database query result in format specifed by $output or null on failure
 	 */
-	function get_row( $query = null, $output = OBJECT, $y = 0 ) {
-		$this->func_call = "\$db->get_row(\"$query\",$output,$y)";
+	public function get_row( $query = null, $output = null, $row = 0 ) {
+		$this->func_call = "\$db->get_row(\"$query\",$output,$row)";
 		if ( $query )
 			$this->query( $query );
 		else
 			return null;
 
-		if ( !isset( $this->last_result[$y] ) )
+		if ( !isset( $this->last_result[$row] ) )
 			return null;
 
-		if ( $output == OBJECT ) {
-			return $this->last_result[$y] ? $this->last_result[$y] : null;
+		if ( null === $output || $output == OBJECT ) {
+			return $this->last_result[$row] ? $this->last_result[$row] : null;
 		} elseif ( $output == ARRAY_A ) {
-			return $this->last_result[$y] ? get_object_vars( $this->last_result[$y] ) : null;
+			return $this->last_result[$row] ? get_object_vars( $this->last_result[$row] ) : null;
 		} elseif ( $output == ARRAY_N ) {
-			return $this->last_result[$y] ? array_values( get_object_vars( $this->last_result[$y] ) ) : null;
+			return $this->last_result[$row] ? array_values( get_object_vars( $this->last_result[$row] ) ) : 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*/);
 		}
@@ -1344,17 +1375,17 @@
 	 * @since 0.71
 	 *
 	 * @param string|null $query Optional. SQL query. Defaults to previous query.
-	 * @param int $x Optional. Column to return. Indexed from 0.
+	 * @param int $column Optional. Column to return. Indexed from 0.
 	 * @return array Database query result. Array indexed from 0 by SQL result row number.
 	 */
-	function get_col( $query = null , $x = 0 ) {
+	public function get_col( $query = null , $column = 0 ) {
 		if ( $query )
 			$this->query( $query );
 
 		$new_array = array();
 		// Extract the column values
 		for ( $i = 0, $j = count( $this->last_result ); $i < $j; $i++ ) {
-			$new_array[$i] = $this->get_var( null, $x, $i );
+			$new_array[$i] = $this->get_var( null, $column, $i );
 		}
 		return $new_array;
 	}
@@ -1372,7 +1403,7 @@
 	 * 	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
 	 */
-	function get_results( $query = null, $output = OBJECT ) {
+	public function get_results( $query = null, $output = null ) {
 		$this->func_call = "\$db->get_results(\"$query\", $output)";
 
 		if ( $query )
@@ -1381,7 +1412,7 @@
 			return null;
 
 		$new_array = array();
-		if ( $output == OBJECT ) {
+		if ( $output === null || $output == OBJECT ) {
 			// Return an integer-keyed array of row objects
 			return $this->last_result;
 		} elseif ( $output == OBJECT_K ) {
@@ -1420,9 +1451,9 @@
 	 * @param int $col_offset Optional. 0: col name. 1: which table the col's in. 2: col's max length. 3: if the col is numeric. 4: col's type
 	 * @return mixed Column Results
 	 */
-	function get_col_info( $info_type = 'name', $col_offset = -1 ) {
+	public function get_col_info( $info_type = 'name', $col_offset = null ) {
 		if ( $this->col_info ) {
-			if ( $col_offset == -1 ) {
+			if ( $col_offset === null ) {
 				$i = 0;
 				$new_array = array();
 				foreach( (array) $this->col_info as $col ) {
@@ -1443,9 +1474,8 @@
 	 *
 	 * @return true
 	 */
-	function timer_start() {
-		$mtime            = explode( ' ', microtime() );
-		$this->time_start = $mtime[1] + $mtime[0];
+	private function timer_start() {
+		$this->time_start = microtime( true );
 		return true;
 	}
 
@@ -1456,11 +1486,9 @@
 	 *
 	 * @return int Total time spent on the query, in milliseconds
 	 */
-	function timer_stop() {
-		$mtime      = explode( ' ', microtime() );
-		$time_end   = $mtime[1] + $mtime[0];
-		$time_total = $time_end - $this->time_start;
-		return $time_total;
+	private function timer_stop() {
+		$time_total = microtime( true ) - $this->time_start;
+		return (int) $time_total;
 	}
 
 	/**
@@ -1474,7 +1502,7 @@
 	 * @param string $error_code Optional. A Computer readable string to identify the error.
 	 * @return false|void
 	 */
-	function bail( $message, $error_code = '500' ) {
+	private function bail( $message, $error_code = '500' ) {
 		if ( !$this->show_errors ) {
 			if ( class_exists( 'WP_Error' ) )
 				$this->error = new WP_Error($error_code, $message);
@@ -1494,7 +1522,7 @@
 	 *
 	 * @return WP_Error
 	 */
-	function check_database_version() {
+	public function check_database_version() {
 		global $wp_version, $required_mysql_version;
 		// Make sure the server has the required MySQL version
 		if ( version_compare($this->db_version(), $required_mysql_version, '<') )
@@ -1502,31 +1530,18 @@
 	}
 
 	/**
-	 * Whether the database supports collation.
-	 *
-	 * Called when WordPress is generating the table scheme.
-	 *
-	 * @since 2.5.0
-	 *
-	 * @return bool True if collation is supported, false if version does not
-	 */
-	function supports_collation() {
-		return $this->has_cap( 'collation' );
-	}
-
-	/**
 	 * Determine if a database supports a particular feature
 	 *
 	 * @since 2.7.0
 	 * @see   wpdb::db_version()
 	 *
-	 * @param string $db_cap the feature
+	 * @param string $feature the database capabilitiy feature
 	 * @return bool
 	 */
-	function has_cap( $db_cap ) {
+	public function has_cap( $feature ) {
 		$version = $this->db_version();
 
-		switch ( strtolower( $db_cap ) ) {
+		switch ( strtolower( $feature ) ) {
 			case 'collation' :    // @since 2.5.0
 			case 'group_concat' : // @since 2.7
 			case 'subqueries' :   // @since 2.7
@@ -1548,7 +1563,7 @@
 	 *
 	 * @return string The name of the calling function
 	 */
-	function get_caller() {
+	private function get_caller() {
 		$trace  = array_reverse( debug_backtrace() );
 		$caller = array();
 
@@ -1568,7 +1583,7 @@
 	 *
 	 * @return false|string false on failure, version number on success
 	 */
-	function db_version() {
+	public function db_version() {
 		return preg_replace( '/[^0-9.].*/', '', mysql_get_server_info( $this->dbh ) );
 	}
 }
