Some wpdb cleanups.
git-svn-id: http://svn.automattic.com/wordpress/trunk@14058 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
c7b7d67892
commit
e0eea8e857
|
@ -22,17 +22,17 @@ define( 'OBJECT', 'OBJECT', true );
|
||||||
/**
|
/**
|
||||||
* @since 2.5.0
|
* @since 2.5.0
|
||||||
*/
|
*/
|
||||||
define( 'OBJECT_K', 'OBJECT_K', false );
|
define( 'OBJECT_K', 'OBJECT_K' );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 0.71
|
* @since 0.71
|
||||||
*/
|
*/
|
||||||
define( 'ARRAY_A', 'ARRAY_A', false );
|
define( 'ARRAY_A', 'ARRAY_A' );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 0.71
|
* @since 0.71
|
||||||
*/
|
*/
|
||||||
define( 'ARRAY_N', 'ARRAY_N', false );
|
define( 'ARRAY_N', 'ARRAY_N' );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WordPress Database Access Abstraction Object
|
* WordPress Database Access Abstraction Object
|
||||||
|
@ -578,7 +578,7 @@ class wpdb {
|
||||||
if ( defined( 'VHOST' ) && empty( $this->blogid ) )
|
if ( defined( 'VHOST' ) && empty( $this->blogid ) )
|
||||||
return $old_prefix;
|
return $old_prefix;
|
||||||
|
|
||||||
$this->prefix = $this->get_blog_prefix( $this->blogid );
|
$this->prefix = $this->get_blog_prefix();
|
||||||
|
|
||||||
foreach ( $this->tables( 'blog' ) as $table => $prefixed_table )
|
foreach ( $this->tables( 'blog' ) as $table => $prefixed_table )
|
||||||
$this->$table = $prefixed_table;
|
$this->$table = $prefixed_table;
|
||||||
|
@ -605,7 +605,7 @@ class wpdb {
|
||||||
$old_blog_id = $this->blogid;
|
$old_blog_id = $this->blogid;
|
||||||
$this->blogid = $blog_id;
|
$this->blogid = $blog_id;
|
||||||
|
|
||||||
$this->prefix = $this->get_blog_prefix( $this->blogid );
|
$this->prefix = $this->get_blog_prefix();
|
||||||
|
|
||||||
foreach ( $this->tables( 'blog' ) as $table => $prefixed_table )
|
foreach ( $this->tables( 'blog' ) as $table => $prefixed_table )
|
||||||
$this->$table = $prefixed_table;
|
$this->$table = $prefixed_table;
|
||||||
|
@ -624,9 +624,9 @@ class wpdb {
|
||||||
* @param int $blog_id Optional.
|
* @param int $blog_id Optional.
|
||||||
* @return string Blog prefix.
|
* @return string Blog prefix.
|
||||||
*/
|
*/
|
||||||
function get_blog_prefix( $blog_id = -1 ) {
|
function get_blog_prefix( $blog_id = null ) {
|
||||||
if ( is_multisite() ) {
|
if ( is_multisite() ) {
|
||||||
if ( $blog_id < 0 )
|
if ( null === $blog_id )
|
||||||
$blog_id = $this->blogid;
|
$blog_id = $this->blogid;
|
||||||
if ( defined( 'MULTISITE' ) && ( 0 == $blog_id || 1 == $blog_id ) )
|
if ( defined( 'MULTISITE' ) && ( 0 == $blog_id || 1 == $blog_id ) )
|
||||||
return $this->base_prefix;
|
return $this->base_prefix;
|
||||||
|
@ -844,9 +844,8 @@ class wpdb {
|
||||||
* %s (string)
|
* %s (string)
|
||||||
* %% (literal percentage sign - no argument needed)
|
* %% (literal percentage sign - no argument needed)
|
||||||
*
|
*
|
||||||
* Both %d and %s are to be left unquoted in the query string and
|
* Both %d and %s are to be left unquoted in the query string and they need an argument passed for them.
|
||||||
* they need an argument passed for them. Literals (%) as parts of
|
* Literals (%) as parts of the query must be properly written as %%.
|
||||||
* 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).
|
* 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 sign, padding, alignment, width or precision specifiers.
|
||||||
|
@ -1355,7 +1354,7 @@ class wpdb {
|
||||||
|
|
||||||
$new_array = array();
|
$new_array = array();
|
||||||
// Extract the column values
|
// Extract the column values
|
||||||
for ( $i=0; $i < count( $this->last_result ); $i++ ) {
|
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, $x, $i );
|
||||||
}
|
}
|
||||||
return $new_array;
|
return $new_array;
|
||||||
|
|
Loading…
Reference in New Issue