PHP Класс wpdb, versionpress

Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$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)

Свойство Тип Описание
$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.

Открытые методы

Метод Описание
__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

Защищенные методы

Метод Описание
load_col_info ( ) Load the column metadata from the last query.

Приватные методы

Метод Описание
_do_query ( string $query ) Internal function to perform the mysql_query() call.

Описание методов

__construct() публичный Метод

PHP5 style constructor for compatibility with PHP5. Does the actual setting up of the class properties and connection to the database.
С версии: 2.0.8
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() публичный Метод

PHP5 style destructor and will run when database object is destroyed.
См. также: wpdb::__construct()
С версии: 2.0.8
public __destruct ( ) : boolean
Результат boolean true

__get() публичный Метод

PHP5 style magic getter, used to lazy-load expensive data.
С версии: 3.5.0
public __get ( string $name ) : mixed
$name string The private member to get, and optionally process
Результат mixed The private member

__isset() публичный Метод

Magic function, for backwards compatibility.
С версии: 3.5.0
public __isset ( string $name ) : boolean
$name string The private member to check
Результат boolean If the member is set or not

__set() публичный Метод

Magic function, for backwards compatibility.
С версии: 3.5.0
public __set ( string $name, mixed $value )
$name string The private member to set
$value mixed The value to set

__unset() публичный Метод

Magic function, for backwards compatibility.
С версии: 3.5.0
public __unset ( string $name )
$name string The private member to unset

_escape() публичный Метод

Escape data. Works on arrays.
С версии: 2.8.0
public _escape ( string | array $data ) : string | array
$data string | array
Результат string | array escaped

_insert_replace_helper() публичный Метод

Runs an insert or replace query based on $type argument.
См. также: wpdb::prepare()
См. также: wpdb::$field_types
См. также: wp_set_wpdb_vars()
С версии: 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.
Результат integer | false The number of rows affected, or false on error.

_real_escape() публичный Метод

Real escape, using mysqli_real_escape_string() or mysql_real_escape_string()
См. также: mysqli_real_escape_string()
См. также: mysql_real_escape_string()
С версии: 2.8.0
public _real_escape ( string $string ) : string
$string string to escape
Результат string escaped

_weak_escape() публичный Метод

Use esc_sql() or wpdb::prepare() instead.
См. также: wpdb::prepare
См. также: esc_sql()
Устаревший: 3.6.0
С версии: 2.8.0
public _weak_escape ( string $string ) : string
$string string
Результат string

bail() публичный Метод

Will not die if wpdb::$show_errors is false.
С версии: 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.
Результат false | void

check_connection() публичный Метод

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.
С версии: 3.9.0
public check_connection ( boolean $allow_bail = true ) : boolean
$allow_bail boolean Optional. Allows the function to bail. Default true.
Результат boolean True if the connection is up.

check_database_version() публичный Метод

Whether MySQL database is at least the required minimum version.
С версии: 2.5.0
public check_database_version ( ) : WP_Error
Результат WP_Error

db_connect() публичный Метод

If $allow_bail is false, the lack of database connection will need to be handled manually.
С версии: 3.0.0
С версии: 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.
Результат boolean True with a successful connection, false on failure.

db_version() публичный Метод

The database version number.
С версии: 2.7.0
public db_version ( ) : false | string
Результат false | string false on failure, version number on success

delete() публичный Метод

wpdb::delete( 'table', array( 'ID' => 1 ) ) wpdb::delete( 'table', array( 'ID' => 1 ), array( '%d' ) )
См. также: wpdb::prepare()
См. также: wpdb::$field_types
См. также: wp_set_wpdb_vars()
С версии: 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.
Результат integer | false The number of rows updated, or false on error.

esc_like() публичный Метод

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 ) );
С версии: 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.
Результат string Text in the form of a LIKE phrase. The output is not SQL safe. Call $wpdb::prepare() or real_escape next.

escape() публичный Метод

Use esc_sql() or wpdb::prepare() instead.
См. также: wpdb::prepare()
См. также: esc_sql()
Устаревший: 3.6.0
С версии: 0.71
public escape ( mixed $data ) : mixed
$data mixed
Результат mixed

escape_by_ref() публичный Метод

Escapes content by reference for insertion into the database, for security
С версии: 2.3.0
public escape_by_ref ( string &$string ) : void
$string string to escape
Результат void

flush() публичный Метод

Kill cached query results.
С версии: 0.71
public flush ( ) : void
Результат void

get_blog_prefix() публичный Метод

Gets blog prefix.
С версии: 3.0.0
public get_blog_prefix ( integer $blog_id = null ) : string
$blog_id integer Optional.
Результат string Blog prefix.

get_caller() публичный Метод

Searches up the list of functions until it reaches the one that would most logically had called this method.
С версии: 2.5.0
public get_caller ( ) : string
Результат string The name of the calling function

get_charset_collate() публичный Метод

The database character collate.
С версии: 3.5.0
public get_charset_collate ( ) : string
Результат string The database character collate.

get_col() публичный Метод

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.
С версии: 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.
Результат array Database query result. Array indexed from 0 by SQL result row number.

get_col_info() публичный Метод

Retrieve column metadata from the last query.
С версии: 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
Результат mixed Column Results

get_results() публичный Метод

Executes a SQL query and returns the entire SQL result.
С версии: 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.
Результат mixed Database query results

get_row() публичный Метод

Executes a SQL query and returns the row from the SQL result.
С версии: 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.
Результат mixed Database query result in format specified by $output or null on failure

get_var() публичный Метод

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.
С версии: 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.
Результат string | null Database query result (as string), or null on failure

has_cap() публичный Метод

Determine if a database supports a particular feature.
См. также: wpdb::db_version()
С версии: 2.7.0
public has_cap ( string $db_cap ) : boolean
$db_cap string The feature to check for.
Результат boolean

hide_errors() публичный Метод

By default database errors are not shown.
См. также: wpdb::show_errors()
С версии: 0.71
public hide_errors ( ) : boolean
Результат boolean Whether showing of errors was active

init_charset() публичный Метод

Set $this->charset and $this->collate
С версии: 3.1.0
public init_charset ( )

insert() публичный Метод

wpdb::insert( 'table', array( 'column' => 'foo', 'field' => 'bar' ) ) wpdb::insert( 'table', array( 'column' => 'foo', 'field' => 1337 ), array( '%s', '%d' ) )
См. также: wpdb::prepare()
См. также: wpdb::$field_types
См. также: wp_set_wpdb_vars()
С версии: 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.
Результат integer | false The number of rows inserted, or false on error.

load_col_info() защищенный Метод

Load the column metadata from the last query.
С версии: 3.5.0
protected load_col_info ( )

prepare() публичный Метод

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' );
С версии: 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()}.
Результат 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() публичный Метод

Print SQL/DB error.
С версии: 0.71
public print_error ( string $str = '' ) : boolean
$str string The error to display
Результат boolean False if the showing of errors is disabled.

query() публичный Метод

More information can be found on the codex page.
С версии: 0.71
public query ( string $query ) : integer | false
$query string Database query
Результат integer | false Number of rows affected/selected or false on error

replace() публичный Метод

wpdb::replace( 'table', array( 'column' => 'foo', 'field' => 'bar' ) ) wpdb::replace( 'table', array( 'column' => 'foo', 'field' => 1337 ), array( '%s', '%d' ) )
См. также: wpdb::prepare()
См. также: wpdb::$field_types
См. также: wp_set_wpdb_vars()
С версии: 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.
Результат integer | false The number of rows affected, or false on error.

select() публичный Метод

The database name will be changed based on the current database connection. On failure, the execution will bail and display an DB error.
С версии: 0.71
public select ( string $db, resource $dbh = null ) : null
$db string MySQL database name
$dbh resource Optional link identifier.
Результат null Always null.

set_blog_id() публичный Метод

Sets blog id.
С версии: 3.0.0
public set_blog_id ( integer $blog_id, integer $site_id ) : string
$blog_id integer
$site_id integer Optional.
Результат string previous blog id

set_charset() публичный Метод

Sets the connection's character set.
С версии: 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() публичный Метод

Sets the table prefix for the WordPress tables.
С версии: 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.
Результат string | WP_Error Old prefix or WP_Error on error

set_sql_mode() публичный Метод

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

show_errors() публичный Метод

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.
См. также: wpdb::hide_errors()
С версии: 0.71
public show_errors ( boolean $show = true ) : boolean
$show boolean Whether to show or hide errors
Результат boolean Old value for showing errors.

supports_collation() публичный Метод

Called when WordPress is generating the table scheme.
Устаревший: 3.5.0
Устаревший: Use wpdb::has_cap( 'collation' )
С версии: 2.5.0
public supports_collation ( ) : boolean
Результат boolean True if collation is supported, false if version does not

suppress_errors() публичный Метод

By default database errors are suppressed, with a simple call to this function they can be enabled.
См. также: wpdb::hide_errors()
С версии: 2.5.0
public suppress_errors ( boolean $suppress = true ) : boolean
$suppress boolean Optional. New value. Defaults to true.
Результат boolean Old value

tables() публичный Метод

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.
С версии: 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.
Результат array Table names. When a prefix is requested, the key is the unprefixed table name.

timer_start() публичный Метод

Starts the timer, for debugging purposes.
С версии: 1.5.0
public timer_start ( ) : true
Результат true

timer_stop() публичный Метод

Stops the debugging timer.
С версии: 1.5.0
public timer_stop ( ) : float
Результат float Total time spent on the query, in seconds

update() публичный Метод

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' ) )
См. также: wpdb::prepare()
См. также: wpdb::$field_types
См. также: wp_set_wpdb_vars()
С версии: 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.
Результат integer | false The number of rows updated, or false on error.

Описание свойств

$base_prefix публичное свойство

WordPress base table prefix.
С версии: 3.0.0
public string $base_prefix
Результат string

$blog_versions публичное свойство

Multisite Blog Versions table
С версии: 3.0.0
public string $blog_versions
Результат string

$blogid публичное свойство

{@internal Missing Description}}
С версии: 3.0.0
public int $blogid
Результат integer

$blogs публичное свойство

Multisite Blogs table
С версии: 3.0.0
public string $blogs
Результат string

$charset публичное свойство

Database table columns charset
С версии: 2.2.0
public string $charset
Результат string

$col_info защищенное свойство

Saved info on the table column
С версии: 0.71
protected array $col_info
Результат array

$collate публичное свойство

Database table columns collate
С версии: 2.2.0
public string $collate
Результат string

$commentmeta публичное свойство

WordPress Comment Metadata table
С версии: 2.9.0
public string $commentmeta
Результат string

$comments публичное свойство

WordPress Comments table
С версии: 1.5.0
public string $comments
Результат string

$dbh защищенное свойство

Database Handle
С версии: 0.71
protected string|mysqli|resource $dbh
Результат string | mysqli | resource

$dbhost защищенное свойство

Database Host
С версии: 3.1.0
protected string $dbhost
Результат string

$dbname защищенное свойство

Database Name
С версии: 3.1.0
protected string $dbname
Результат string

$dbpassword защищенное свойство

Database Password
С версии: 3.1.0
protected string $dbpassword
Результат string

$dbuser защищенное свойство

Database Username
С версии: 2.9.0
protected string $dbuser
Результат string

$field_types публичное свойство

Keys are column names, values are format types: 'ID' => '%d'
См. также: wpdb::prepare()
См. также: wpdb::insert()
См. также: wpdb::update()
См. также: wpdb::delete()
См. также: wp_set_wpdb_vars()
С версии: 2.8.0
public array $field_types
Результат array

$func_call публичное свойство

A textual description of the last query/get_row/get_var call
С версии: 3.0.0
public string $func_call
Результат string

$global_tables публичное свойство

List of WordPress global tables
См. также: wpdb::tables()
С версии: 3.0.0
public array $global_tables
Результат array

$incompatible_modes защищенное свойство

A list of incompatible SQL modes.
С версии: 3.9.0
protected array $incompatible_modes
Результат array

$insert_id публичное свойство

The ID generated for an AUTO_INCREMENT column by the previous query (usually INSERT).
С версии: 0.71
public int $insert_id
Результат integer

$is_mysql публичное свойство

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.
С версии: 3.3.0
public bool $is_mysql
Результат boolean

$last_error публичное свойство

The last error during query.
С версии: 2.5.0
public string $last_error
Результат string

$last_query публичное свойство

Last query made
С версии: 0.71
public array $last_query
Результат array

$last_result публичное свойство

Results of the last query made
С версии: 0.71
public array|null $last_result
Результат array | null

$ms_global_tables публичное свойство

List of Multisite global tables
См. также: wpdb::tables()
С версии: 3.0.0
public array $ms_global_tables
Результат array

$num_queries публичное свойство

Amount of queries made
С версии: 1.2.0
public int $num_queries
Результат integer

$num_rows публичное свойство

Count of rows returned by previous query
С версии: 0.71
public int $num_rows
Результат integer

$old_tables публичное свойство

categories, post2cat, and link2cat were deprecated in 2.3.0, db version 5539
См. также: wpdb::tables()
С версии: 2.9.0
public array $old_tables
Результат array

$options публичное свойство

WordPress Options table
С версии: 1.5.0
public string $options
Результат string

$postmeta публичное свойство

WordPress Post Metadata table
С версии: 1.5.0
public string $postmeta
Результат string

$posts публичное свойство

WordPress Posts table
С версии: 1.5.0
public string $posts
Результат string

$prefix публичное свойство

You can set this to have multiple WordPress installations in a single database. The second reason is for possible security precautions.
С версии: 2.5.0
public string $prefix
Результат string

$queries публичное свойство

Saved queries that were executed
С версии: 1.5.0
public array $queries
Результат array

$ready публичное свойство

Whether the database queries are ready to start executing.
С версии: 2.3.2
public bool $ready
Результат boolean

$reconnect_retries защищенное свойство

The number of times to retry reconnecting before dying.
См. также: wpdb::check_connection()
С версии: 3.9.0
protected int $reconnect_retries
Результат integer

$registration_log публичное свойство

Multisite Registration Log table
С версии: 3.0.0
public string $registration_log
Результат string

$result защищенное свойство

MySQL result, which is either a resource or boolean.
С версии: 0.71
protected mixed $result
Результат mixed

$rows_affected публичное свойство

Count of affected rows by previous query
С версии: 0.71
public int $rows_affected
Результат integer

$show_errors публичное свойство

Default behavior is to show errors if both WP_DEBUG and WP_DEBUG_DISPLAY evaluated to true.
С версии: 0.71
public bool $show_errors
Результат boolean

$signups публичное свойство

Multisite Signups table
С версии: 3.0.0
public string $signups
Результат string

$site публичное свойство

Multisite Sites table
С версии: 3.0.0
public string $site
Результат string

$sitecategories публичное свойство

Multisite Sitewide Terms table
С версии: 3.0.0
public string $sitecategories
Результат string

$siteid публичное свойство

{@internal Missing Description}}
С версии: 3.0.0
public int $siteid
Результат integer

$sitemeta публичное свойство

Multisite Site Metadata table
С версии: 3.0.0
public string $sitemeta
Результат string

$suppress_errors публичное свойство

Whether to suppress errors during the DB bootstrapping.
С версии: 2.5.0
public bool $suppress_errors
Результат boolean

$tables публичное свойство

List of WordPress per-blog tables
См. также: wpdb::tables()
С версии: 2.5.0
public array $tables
Результат array

$term_relationships публичное свойство

WordPress Term Relationships table
С версии: 2.3.0
public string $term_relationships
Результат string

$term_taxonomy публичное свойство

WordPress Term Taxonomy table
С версии: 2.3.0
public string $term_taxonomy
Результат string

$terms публичное свойство

WordPress Terms table
С версии: 2.3.0
public string $terms
Результат string

$usermeta публичное свойство

WordPress User Metadata table
С версии: 2.3.0
public string $usermeta
Результат string

$users публичное свойство

WordPress Users table
С версии: 1.5.0
public string $users
Результат string