PHP Class wpdb, versionpress

Show file Open project: versionpress/versionpress Class Usage Examples

Public Properties

Property Type Description
$base_prefix string WordPress base table prefix.
$blog_versions string Multisite Blog Versions table
$blogid integer {@internal Missing Description}}
$blogs string Multisite Blogs table
$charset string Database table columns charset
$collate string Database table columns collate
$commentmeta string WordPress Comment Metadata table
$comments string WordPress Comments table
$field_types array Keys are column names, values are format types: 'ID' => '%d'
$func_call string A textual description of the last query/get_row/get_var call
$global_tables array List of WordPress global tables
$insert_id integer The ID generated for an AUTO_INCREMENT column by the previous query (usually INSERT).
$is_mysql boolean Set in WPDB::db_connect() to true, by default. This is used when checking against the required MySQL version for WordPress. Normally, a replacement database drop-in (db.php) will skip these checks, but setting this to true will force the checks to occur.
$last_error string The last error during query.
$last_query array Last query made
$last_result array | null Results of the last query made
$links string WordPress Links table
$ms_global_tables array List of Multisite global tables
$num_queries integer Amount of queries made
$num_rows integer Count of rows returned by previous query
$old_tables array categories, post2cat, and link2cat were deprecated in 2.3.0, db version 5539
$options string WordPress Options table
$postmeta string WordPress Post Metadata table
$posts string WordPress Posts table
$prefix string You can set this to have multiple WordPress installations in a single database. The second reason is for possible security precautions.
$queries array Saved queries that were executed
$ready boolean Whether the database queries are ready to start executing.
$registration_log string Multisite Registration Log table
$rows_affected integer Count of affected rows by previous query
$show_errors boolean Default behavior is to show errors if both WP_DEBUG and WP_DEBUG_DISPLAY evaluated to true.
$signups string Multisite Signups table
$site string Multisite Sites table
$sitecategories string Multisite Sitewide Terms table
$siteid integer {@internal Missing Description}}
$sitemeta string Multisite Site Metadata table
$suppress_errors boolean Whether to suppress errors during the DB bootstrapping.
$tables array List of WordPress per-blog tables
$term_relationships string WordPress Term Relationships table
$term_taxonomy string WordPress Term Taxonomy table
$terms string WordPress Terms table
$usermeta string WordPress User Metadata table
$users string WordPress Users table

Protected Properties

Property Type Description
$col_info array Saved info on the table column
$dbh string | mysqli | resource Database Handle
$dbhost string Database Host
$dbname string Database Name
$dbpassword string Database Password
$dbuser string Database Username
$incompatible_modes array A list of incompatible SQL modes.
$reconnect_retries integer The number of times to retry reconnecting before dying.
$result mixed MySQL result, which is either a resource or boolean.

Public Methods

Method Description
__construct ( string $dbuser, string $dbpassword, string $dbname, string $dbhost ) Connects to the database server and selects a database
__destruct ( ) : boolean PHP5 style destructor and will run when database object is destroyed.
__get ( string $name ) : mixed PHP5 style magic getter, used to lazy-load expensive data.
__isset ( string $name ) : boolean Magic function, for backwards compatibility.
__set ( string $name, mixed $value ) Magic function, for backwards compatibility.
__unset ( string $name ) Magic function, for backwards compatibility.
_escape ( string | array $data ) : string | array Escape data. Works on arrays.
_insert_replace_helper ( string $table, array $data, array | string $format = null, string $type = 'INSERT' ) : integer | false Helper function for insert and replace.
_real_escape ( string $string ) : string Real escape, using mysqli_real_escape_string() or mysql_real_escape_string()
_weak_escape ( string $string ) : string Do not use, deprecated.
bail ( string $message, string $error_code = '500' ) : false | void Wraps errors in a nice header and footer and dies.
check_connection ( boolean $allow_bail = true ) : boolean Check that the connection to the database is still up. If not, try to reconnect.
check_database_version ( ) : WP_Error Whether MySQL database is at least the required minimum version.
db_connect ( boolean $allow_bail = true ) : boolean Connect to and select database.
db_version ( ) : false | string The database version number.
delete ( string $table, array $where, array | string $where_format = null ) : integer | false Delete a row in the table
esc_like ( string $text ) : string First half of escaping for LIKE special characters % and _ before preparing for MySQL.
escape ( mixed $data ) : mixed Do not use, deprecated.
escape_by_ref ( string &$string ) : void Escapes content by reference for insertion into the database, for security
flush ( ) : void Kill cached query results.
get_blog_prefix ( integer $blog_id = null ) : string Gets blog prefix.
get_caller ( ) : string Retrieve the name of the function that called wpdb.
get_charset_collate ( ) : string The database character collate.
get_col ( string | null $query = null, integer $x ) : array Retrieve one column from the database.
get_col_info ( string $info_type = 'name', integer $col_offset ) : mixed Retrieve column metadata from the last query.
get_results ( string $query = null, string $output = OBJECT ) : mixed Retrieve an entire SQL result set from the database (i.e., many rows)
get_row ( string | null $query = null, string $output = OBJECT, integer $y ) : mixed Retrieve one row from the database.
get_var ( string | null $query = null, integer $x, integer $y ) : string | null Retrieve one variable from the database.
has_cap ( string $db_cap ) : boolean Determine if a database supports a particular feature.
hide_errors ( ) : boolean Disables showing of database errors.
init_charset ( ) Set $this->charset and $this->collate
insert ( string $table, array $data, array | string $format = null ) : integer | false Insert a row into a table.
prepare ( string $query, array | mixed $args ) : null | false | string Prepares a SQL query for safe execution. Uses sprintf()-like syntax.
print_error ( string $str = '' ) : boolean Print SQL/DB error.
query ( string $query ) : integer | false Perform a MySQL database query, using current database connection.
replace ( string $table, array $data, array | string $format = null ) : integer | false Replace a row into a table.
select ( string $db, resource $dbh = null ) : null Selects a database using the current database connection.
set_blog_id ( integer $blog_id, integer $site_id ) : string Sets blog id.
set_charset ( resource $dbh, string $charset = null, string $collate = null ) Sets the connection's character set.
set_prefix ( string $prefix, boolean $set_table_names = true ) : string | WP_Error Sets the table prefix for the WordPress tables.
set_sql_mode ( array $modes = [] ) Change the current SQL mode, and ensure its WordPress compatibility.
show_errors ( boolean $show = true ) : boolean Enables showing of database errors.
supports_collation ( ) : boolean Whether the database supports collation.
suppress_errors ( boolean $suppress = true ) : boolean Whether to suppress database errors.
tables ( string $scope = 'all', boolean $prefix = true, integer $blog_id ) : array Returns an array of WordPress tables.
timer_start ( ) : true Starts the timer, for debugging purposes.
timer_stop ( ) : float Stops the debugging timer.
update ( string $table, array $data, array $where, array | string $format = null, array | string $where_format = null ) : integer | false Update a row in the table

Protected Methods

Method Description
load_col_info ( ) Load the column metadata from the last query.

Private Methods

Method Description
_do_query ( string $query ) Internal function to perform the mysql_query() call.

Method Details

__construct() public method

PHP5 style constructor for compatibility with PHP5. Does the actual setting up of the class properties and connection to the database.
public __construct ( string $dbuser, string $dbpassword, string $dbname, string $dbhost )
$dbuser string MySQL database user
$dbpassword string MySQL database password
$dbname string MySQL database name
$dbhost string MySQL database host

__destruct() public method

PHP5 style destructor and will run when database object is destroyed.
See also: wpdb::__construct()
Since: 2.0.8
public __destruct ( ) : boolean
return boolean true

__get() public method

PHP5 style magic getter, used to lazy-load expensive data.
Since: 3.5.0
public __get ( string $name ) : mixed
$name string The private member to get, and optionally process
return mixed The private member

__isset() public method

Magic function, for backwards compatibility.
Since: 3.5.0
public __isset ( string $name ) : boolean
$name string The private member to check
return boolean If the member is set or not

__set() public method

Magic function, for backwards compatibility.
Since: 3.5.0
public __set ( string $name, mixed $value )
$name string The private member to set
$value mixed The value to set

__unset() public method

Magic function, for backwards compatibility.
Since: 3.5.0
public __unset ( string $name )
$name string The private member to unset

_escape() public method

Escape data. Works on arrays.
Since: 2.8.0
public _escape ( string | array $data ) : string | array
$data string | array
return string | array escaped

_insert_replace_helper() public method

Runs an insert or replace query based on $type argument.
See also: wpdb::prepare()
See also: wpdb::$field_types
See also: wp_set_wpdb_vars()
Since: 3.0.0
public _insert_replace_helper ( string $table, array $data, array | string $format = null, string $type = 'INSERT' ) : integer | false
$table string table name
$data array Data to insert (in column => value pairs). Both $data columns and $data values should be "raw" (neither should be SQL escaped).
$format array | string 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', '%f', '%s' (integer, float, string). If omitted, all values in $data will be treated as strings unless otherwise specified in wpdb::$field_types.
$type string Optional. What type of operation is this? INSERT or REPLACE. Defaults to INSERT.
return integer | false The number of rows affected, or false on error.

_real_escape() public method

Real escape, using mysqli_real_escape_string() or mysql_real_escape_string()
See also: mysqli_real_escape_string()
See also: mysql_real_escape_string()
Since: 2.8.0
public _real_escape ( string $string ) : string
$string string to escape
return string escaped

_weak_escape() public method

Use esc_sql() or wpdb::prepare() instead.
See also: wpdb::prepare
See also: esc_sql()
Deprecation: 3.6.0
Since: 2.8.0
public _weak_escape ( string $string ) : string
$string string
return string

bail() public method

Will not die if wpdb::$show_errors is false.
Since: 1.5.0
public bail ( string $message, string $error_code = '500' ) : false | void
$message string The Error message
$error_code string Optional. A Computer readable string to identify the error.
return false | void

check_connection() public method

If this function is unable to reconnect, it will forcibly die, or if after the the template_redirect hook has been fired, return false instead. If $allow_bail is false, the lack of database connection will need to be handled manually.
Since: 3.9.0
public check_connection ( boolean $allow_bail = true ) : boolean
$allow_bail boolean Optional. Allows the function to bail. Default true.
return boolean True if the connection is up.

check_database_version() public method

Whether MySQL database is at least the required minimum version.
Since: 2.5.0
public check_database_version ( ) : WP_Error
return WP_Error

db_connect() public method

If $allow_bail is false, the lack of database connection will need to be handled manually.
Since: 3.0.0
Since: 3.9.0 $allow_bail parameter added.
public db_connect ( boolean $allow_bail = true ) : boolean
$allow_bail boolean Optional. Allows the function to bail. Default true.
return boolean True with a successful connection, false on failure.

db_version() public method

The database version number.
Since: 2.7.0
public db_version ( ) : false | string
return false | string false on failure, version number on success

delete() public method

wpdb::delete( 'table', array( 'ID' => 1 ) ) wpdb::delete( 'table', array( 'ID' => 1 ), array( '%d' ) )
See also: wpdb::prepare()
See also: wpdb::$field_types
See also: wp_set_wpdb_vars()
Since: 3.4.0
public delete ( string $table, array $where, array | string $where_format = null ) : integer | false
$table string table name
$where array 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".
$where_format array | string 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', '%f', '%s' (integer, float, string). If omitted, all values in $where will be treated as strings unless otherwise specified in wpdb::$field_types.
return integer | false The number of rows updated, or false on error.

esc_like() public method

Use this only before wpdb::prepare() or esc_sql(). Reversing the order is very bad for security. Example Prepared Statement: $wild = '%'; $find = 'only 43% of planets'; $like = $wild . $wpdb->esc_like( $find ) . $wild; $sql = $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE post_content LIKE %s", $like ); Example Escape Chain: $sql = esc_sql( $wpdb->esc_like( $input ) );
Since: 4.0.0
public esc_like ( string $text ) : string
$text string The raw text to be escaped. The input typed by the user should have no extra or deleted slashes.
return string Text in the form of a LIKE phrase. The output is not SQL safe. Call $wpdb::prepare() or real_escape next.

escape() public method

Use esc_sql() or wpdb::prepare() instead.
See also: wpdb::prepare()
See also: esc_sql()
Deprecation: 3.6.0
Since: 0.71
public escape ( mixed $data ) : mixed
$data mixed
return mixed

escape_by_ref() public method

Escapes content by reference for insertion into the database, for security
Since: 2.3.0
public escape_by_ref ( string &$string ) : void
$string string to escape
return void

flush() public method

Kill cached query results.
Since: 0.71
public flush ( ) : void
return void

get_blog_prefix() public method

Gets blog prefix.
Since: 3.0.0
public get_blog_prefix ( integer $blog_id = null ) : string
$blog_id integer Optional.
return string Blog prefix.

get_caller() public method

Searches up the list of functions until it reaches the one that would most logically had called this method.
Since: 2.5.0
public get_caller ( ) : string
return string The name of the calling function

get_charset_collate() public method

The database character collate.
Since: 3.5.0
public get_charset_collate ( ) : string
return string The database character collate.

get_col() public method

Executes a SQL query and returns the column from the SQL result. If the SQL result contains more than one column, this function returns the column specified. If $query is null, this function returns the specified column from the previous SQL result.
Since: 0.71
public get_col ( string | null $query = null, integer $x ) : array
$query string | null Optional. SQL query. Defaults to previous query.
$x integer Optional. Column to return. Indexed from 0.
return array Database query result. Array indexed from 0 by SQL result row number.

get_col_info() public method

Retrieve column metadata from the last query.
Since: 0.71
public get_col_info ( string $info_type = 'name', integer $col_offset ) : mixed
$info_type string Optional. Type one of name, table, def, max_length, not_null, primary_key, multiple_key, unique_key, numeric, blob, type, unsigned, zerofill
$col_offset integer 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

get_results() public method

Executes a SQL query and returns the entire SQL result.
Since: 0.71
public get_results ( string $query = null, string $output = OBJECT ) : mixed
$query string SQL query.
$output string Optional. Any 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

get_row() public method

Executes a SQL query and returns the row from the SQL result.
Since: 0.71
public get_row ( string | null $query = null, string $output = OBJECT, integer $y ) : mixed
$query string | null SQL query.
$output string 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.
$y integer Optional. Row to return. Indexed from 0.
return mixed Database query result in format specified by $output or null on failure

get_var() public method

Executes a SQL query and returns the value from the SQL result. If the SQL result contains more than one column and/or more than one row, this function returns the value in the column and row specified. If $query is null, this function returns the value in the specified column and row from the previous SQL result.
Since: 0.71
public get_var ( string | null $query = null, integer $x, integer $y ) : string | null
$query string | null Optional. SQL query. Defaults to null, use the result from the previous query.
$x integer Optional. Column of value to return. Indexed from 0.
$y integer Optional. Row of value to return. Indexed from 0.
return string | null Database query result (as string), or null on failure

has_cap() public method

Determine if a database supports a particular feature.
See also: wpdb::db_version()
Since: 2.7.0
public has_cap ( string $db_cap ) : boolean
$db_cap string The feature to check for.
return boolean

hide_errors() public method

By default database errors are not shown.
See also: wpdb::show_errors()
Since: 0.71
public hide_errors ( ) : boolean
return boolean Whether showing of errors was active

init_charset() public method

Set $this->charset and $this->collate
Since: 3.1.0
public init_charset ( )

insert() public method

wpdb::insert( 'table', array( 'column' => 'foo', 'field' => 'bar' ) ) wpdb::insert( 'table', array( 'column' => 'foo', 'field' => 1337 ), array( '%s', '%d' ) )
See also: wpdb::prepare()
See also: wpdb::$field_types
See also: wp_set_wpdb_vars()
Since: 2.5.0
public insert ( string $table, array $data, array | string $format = null ) : integer | false
$table string table name
$data array Data to insert (in column => value pairs). Both $data columns and $data values should be "raw" (neither should be SQL escaped).
$format array | string 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', '%f', '%s' (integer, float, string). If omitted, all values in $data will be treated as strings unless otherwise specified in wpdb::$field_types.
return integer | false The number of rows inserted, or false on error.

load_col_info() protected method

Load the column metadata from the last query.
Since: 3.5.0
protected load_col_info ( )

prepare() public method

The following directives can be used in the query format string: %d (integer) %f (float) %s (string) %% (literal percentage sign - no argument needed) All of %d, %f, 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 (integer), %f (float), and %s (string). Does not support sign, padding, alignment, width or precision specifiers. Does not support argument numbering/swapping. May be called like {@link http://php.net/sprintf sprintf()} or like {@link http://php.net/vsprintf vsprintf()}. Both %d and %s should be left unquoted in the query string. 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' );
Since: 2.3.0
public prepare ( string $query, array | mixed $args ) : null | false | string
$query string Query statement with sprintf()-like placeholders
$args array | mixed 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()}.
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

print_error() public method

Print SQL/DB error.
Since: 0.71
public print_error ( string $str = '' ) : boolean
$str string The error to display
return boolean False if the showing of errors is disabled.

query() public method

More information can be found on the codex page.
Since: 0.71
public query ( string $query ) : integer | false
$query string Database query
return integer | false Number of rows affected/selected or false on error

replace() public method

wpdb::replace( 'table', array( 'column' => 'foo', 'field' => 'bar' ) ) wpdb::replace( 'table', array( 'column' => 'foo', 'field' => 1337 ), array( '%s', '%d' ) )
See also: wpdb::prepare()
See also: wpdb::$field_types
See also: wp_set_wpdb_vars()
Since: 3.0.0
public replace ( string $table, array $data, array | string $format = null ) : integer | false
$table string table name
$data array Data to insert (in column => value pairs). Both $data columns and $data values should be "raw" (neither should be SQL escaped).
$format array | string 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', '%f', '%s' (integer, float, string). If omitted, all values in $data will be treated as strings unless otherwise specified in wpdb::$field_types.
return integer | false The number of rows affected, or false on error.

select() public method

The database name will be changed based on the current database connection. On failure, the execution will bail and display an DB error.
Since: 0.71
public select ( string $db, resource $dbh = null ) : null
$db string MySQL database name
$dbh resource Optional link identifier.
return null Always null.

set_blog_id() public method

Sets blog id.
Since: 3.0.0
public set_blog_id ( integer $blog_id, integer $site_id ) : string
$blog_id integer
$site_id integer Optional.
return string previous blog id

set_charset() public method

Sets the connection's character set.
Since: 3.1.0
public set_charset ( resource $dbh, string $charset = null, string $collate = null )
$dbh resource The resource given by mysql_connect
$charset string The character set (optional)
$collate string The collation (optional)

set_prefix() public method

Sets the table prefix for the WordPress tables.
Since: 2.5.0
public set_prefix ( string $prefix, boolean $set_table_names = true ) : string | WP_Error
$prefix string Alphanumeric name for the new prefix.
$set_table_names boolean Optional. Whether the table names, e.g. wpdb::$posts, should be updated or not.
return string | WP_Error Old prefix or WP_Error on error

set_sql_mode() public method

If no modes are passed, it will ensure the current MySQL server modes are compatible.
Since: 3.9.0
public set_sql_mode ( array $modes = [] )
$modes array Optional. A list of SQL modes to set.

show_errors() public method

This function should be used only to enable showing of errors. wpdb::hide_errors() should be used instead for hiding of errors. However, this function can be used to enable and disable showing of database errors.
See also: wpdb::hide_errors()
Since: 0.71
public show_errors ( boolean $show = true ) : boolean
$show boolean Whether to show or hide errors
return boolean Old value for showing errors.

supports_collation() public method

Called when WordPress is generating the table scheme.
Deprecation: 3.5.0
Deprecation: Use wpdb::has_cap( 'collation' )
Since: 2.5.0
public supports_collation ( ) : boolean
return boolean True if collation is supported, false if version does not

suppress_errors() public method

By default database errors are suppressed, with a simple call to this function they can be enabled.
See also: wpdb::hide_errors()
Since: 2.5.0
public suppress_errors ( boolean $suppress = true ) : boolean
$suppress boolean Optional. New value. Defaults to true.
return boolean Old value

tables() public method

Also allows for the CUSTOM_USER_TABLE and CUSTOM_USER_META_TABLE to override the WordPress users and usermeta tables that would otherwise be determined by the prefix. The scope argument can take one of the following: 'all' - returns 'all' and 'global' tables. No old tables are returned. 'blog' - returns the blog-level tables for the queried blog. 'global' - returns the global tables for the installation, returning multisite tables only if running multisite. 'ms_global' - returns the multisite global tables, regardless if current installation is multisite. 'old' - returns tables which are deprecated.
Since: 3.0.0
public tables ( string $scope = 'all', boolean $prefix = true, integer $blog_id ) : array
$scope string Optional. Can be all, global, ms_global, blog, or old tables. Defaults to all.
$prefix boolean Optional. Whether to include table prefixes. Default true. If blog prefix is requested, then the custom users and usermeta tables will be mapped.
$blog_id integer 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.

timer_start() public method

Starts the timer, for debugging purposes.
Since: 1.5.0
public timer_start ( ) : true
return true

timer_stop() public method

Stops the debugging timer.
Since: 1.5.0
public timer_stop ( ) : float
return float Total time spent on the query, in seconds

update() public method

wpdb::update( 'table', array( 'column' => 'foo', 'field' => 'bar' ), array( 'ID' => 1 ) ) wpdb::update( 'table', array( 'column' => 'foo', 'field' => 1337 ), array( 'ID' => 1 ), array( '%s', '%d' ), array( '%d' ) )
See also: wpdb::prepare()
See also: wpdb::$field_types
See also: wp_set_wpdb_vars()
Since: 2.5.0
public update ( string $table, array $data, array $where, array | string $format = null, array | string $where_format = null ) : integer | false
$table string table name
$data array Data to update (in column => value pairs). Both $data columns and $data values should be "raw" (neither should be SQL escaped).
$where array 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".
$format array | string 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', '%f', '%s' (integer, float, string). If omitted, all values in $data will be treated as strings unless otherwise specified in wpdb::$field_types.
$where_format array | string 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', '%f', '%s' (integer, float, string). If omitted, all values in $where will be treated as strings.
return integer | false The number of rows updated, or false on error.

Property Details

$base_prefix public property

WordPress base table prefix.
Since: 3.0.0
public string $base_prefix
return string

$blog_versions public property

Multisite Blog Versions table
Since: 3.0.0
public string $blog_versions
return string

$blogid public property

{@internal Missing Description}}
Since: 3.0.0
public int $blogid
return integer

$blogs public property

Multisite Blogs table
Since: 3.0.0
public string $blogs
return string

$charset public property

Database table columns charset
Since: 2.2.0
public string $charset
return string

$col_info protected property

Saved info on the table column
Since: 0.71
protected array $col_info
return array

$collate public property

Database table columns collate
Since: 2.2.0
public string $collate
return string

$commentmeta public property

WordPress Comment Metadata table
Since: 2.9.0
public string $commentmeta
return string

$comments public property

WordPress Comments table
Since: 1.5.0
public string $comments
return string

$dbh protected property

Database Handle
Since: 0.71
protected string|mysqli|resource $dbh
return string | mysqli | resource

$dbhost protected property

Database Host
Since: 3.1.0
protected string $dbhost
return string

$dbname protected property

Database Name
Since: 3.1.0
protected string $dbname
return string

$dbpassword protected property

Database Password
Since: 3.1.0
protected string $dbpassword
return string

$dbuser protected property

Database Username
Since: 2.9.0
protected string $dbuser
return string

$field_types public property

Keys are column names, values are format types: 'ID' => '%d'
See also: wpdb::prepare()
See also: wpdb::insert()
See also: wpdb::update()
See also: wpdb::delete()
See also: wp_set_wpdb_vars()
Since: 2.8.0
public array $field_types
return array

$func_call public property

A textual description of the last query/get_row/get_var call
Since: 3.0.0
public string $func_call
return string

$global_tables public property

List of WordPress global tables
See also: wpdb::tables()
Since: 3.0.0
public array $global_tables
return array

$incompatible_modes protected property

A list of incompatible SQL modes.
Since: 3.9.0
protected array $incompatible_modes
return array

$insert_id public property

The ID generated for an AUTO_INCREMENT column by the previous query (usually INSERT).
Since: 0.71
public int $insert_id
return integer

$is_mysql public property

Set in WPDB::db_connect() to true, by default. This is used when checking against the required MySQL version for WordPress. Normally, a replacement database drop-in (db.php) will skip these checks, but setting this to true will force the checks to occur.
Since: 3.3.0
public bool $is_mysql
return boolean

$last_error public property

The last error during query.
Since: 2.5.0
public string $last_error
return string

$last_query public property

Last query made
Since: 0.71
public array $last_query
return array

$last_result public property

Results of the last query made
Since: 0.71
public array|null $last_result
return array | null

$ms_global_tables public property

List of Multisite global tables
See also: wpdb::tables()
Since: 3.0.0
public array $ms_global_tables
return array

$num_queries public property

Amount of queries made
Since: 1.2.0
public int $num_queries
return integer

$num_rows public property

Count of rows returned by previous query
Since: 0.71
public int $num_rows
return integer

$old_tables public property

categories, post2cat, and link2cat were deprecated in 2.3.0, db version 5539
See also: wpdb::tables()
Since: 2.9.0
public array $old_tables
return array

$options public property

WordPress Options table
Since: 1.5.0
public string $options
return string

$postmeta public property

WordPress Post Metadata table
Since: 1.5.0
public string $postmeta
return string

$posts public property

WordPress Posts table
Since: 1.5.0
public string $posts
return string

$prefix public property

You can set this to have multiple WordPress installations in a single database. The second reason is for possible security precautions.
Since: 2.5.0
public string $prefix
return string

$queries public property

Saved queries that were executed
Since: 1.5.0
public array $queries
return array

$ready public property

Whether the database queries are ready to start executing.
Since: 2.3.2
public bool $ready
return boolean

$reconnect_retries protected property

The number of times to retry reconnecting before dying.
See also: wpdb::check_connection()
Since: 3.9.0
protected int $reconnect_retries
return integer

$registration_log public property

Multisite Registration Log table
Since: 3.0.0
public string $registration_log
return string

$result protected property

MySQL result, which is either a resource or boolean.
Since: 0.71
protected mixed $result
return mixed

$rows_affected public property

Count of affected rows by previous query
Since: 0.71
public int $rows_affected
return integer

$show_errors public property

Default behavior is to show errors if both WP_DEBUG and WP_DEBUG_DISPLAY evaluated to true.
Since: 0.71
public bool $show_errors
return boolean

$signups public property

Multisite Signups table
Since: 3.0.0
public string $signups
return string

$site public property

Multisite Sites table
Since: 3.0.0
public string $site
return string

$sitecategories public property

Multisite Sitewide Terms table
Since: 3.0.0
public string $sitecategories
return string

$siteid public property

{@internal Missing Description}}
Since: 3.0.0
public int $siteid
return integer

$sitemeta public property

Multisite Site Metadata table
Since: 3.0.0
public string $sitemeta
return string

$suppress_errors public property

Whether to suppress errors during the DB bootstrapping.
Since: 2.5.0
public bool $suppress_errors
return boolean

$tables public property

List of WordPress per-blog tables
See also: wpdb::tables()
Since: 2.5.0
public array $tables
return array

$term_relationships public property

WordPress Term Relationships table
Since: 2.3.0
public string $term_relationships
return string

$term_taxonomy public property

WordPress Term Taxonomy table
Since: 2.3.0
public string $term_taxonomy
return string

$terms public property

WordPress Terms table
Since: 2.3.0
public string $terms
return string

$usermeta public property

WordPress User Metadata table
Since: 2.3.0
public string $usermeta
return string

$users public property

WordPress Users table
Since: 1.5.0
public string $users
return string