| package | BackPress |
|---|---|
| inherited_from | \BPDB |
BPDB() : \unknown
| since | 1.0 |
|---|
\unknownReturns the result of bpdb::__construct()__construct()
Grabs the arguments, calls bpdb::_init() and then connects to the database
| inherited_from | \BPDB::__construct() |
|---|
__construct() : void
Grabs the arguments, calls bpdb::_init() and then connects to the database
| since | 1.0 |
|---|
__destruct() : boolean
| since | 1.0 |
|---|
booleanAlways returns true_escape($data)
_init(array $args) : array
| since | 1.0 |
|---|
arrayThe provided connection settings
arrayThe current connection settings after processing by init_real_escape($string)
_weak_escape($string)
add_db_server(string $ds, array $args = null)
stringDataset: the name of the dataset.
arrayname => string DB name (required) user => string DB user (optional: false) password => string DB user password (optional: false) host => string DB hostname (optional: 'localhost') charset => string DB default charset. Used in a SET NAMES query. (optional) collate => string DB default collation. If charset supplied, optionally added to the SET NAMES query (optional)
add_db_table(string $ds, string $table)
stringDataset: the name of the dataset.
string
bail(string $message) : false | void
Will not die if bpdb::$show_errors is true
| since | 1.0 |
|---|
string
falsevoid
check_database_version($dbh_or_table = false) : \WP_Error
| since | 1.0 |
|---|
\WP_Errordb_connect(string $query = '') : resource
| inherited_from | \BPDB::db_connect() |
|---|
stringquery
resourcemysql database connectiondb_connect(string $query = '') : resource
| since | 1.0 |
|---|
stringquery
resourcemysql database connectiondb_connect_host(array $args) : void | boolean
| since | 1.0 |
|---|
arrayargs name => string DB name (required) user => string DB user (optional: false) password => string DB user password (optional: false) host => string DB hostname (optional: 'localhost') charset => string DB default charset. Used in a SET NAMES query. (optional) collate => string DB default collation. If charset supplied, optionally added to the SET NAMES query (optional)
voidbooleanvoid if cannot connect, false if cannot select, true if successdb_version(false|string|resource $dbh_or_table = false) : false | string
| since | 1.0 |
|---|
falsestringresourceWhich database to test. False = the currently selected database, string = the database containing the specified table, resource = the database corresponding to the specified mysql resource.
falsestringfalse on failure, version number on successescape(string|array $data) : string
| since | 1.0 |
|---|
stringarray
stringquery safe stringescape_by_ref($string)
| since | 1.0 |
|---|
escape_deep(array $array)
array
flush()
| since | 1.0 |
|---|
get_caller() : string
Requires PHP 4.3 and searches up the list of functions until it reaches the one that would most logically had called this method.
| since | 1.0 |
|---|
stringThe name of the calling functionget_col(string|null $query= null, integer $x= 0) : array
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 | 1.0 |
|---|
stringnullSQL query. If null, use the result from the previous query.
integerColumn to return. Indexed from 0.
arrayDatabase query result. Array indexed from 0 by SQL result row number.get_col_info(string $info_type= 'name', integer $col_offset= -1) : mixed
| since | 1.0 |
|---|
stringone of name, table, def, max_length, not_null, primary_key, multiple_key, unique_key, numeric, blob, type, unsigned, zerofill
integer0: col name. 1: which table the col's in. 2: col's max length. 3: if the col is numeric. 4: col's type
mixedColumn Resultsget_error(string $str = '')
| since | 1.0 |
|---|
stringError string
get_results(string $query= null, string $output= OBJECT) : mixed
Executes a SQL query and returns the entire SQL result.
| since | 1.0 |
|---|
stringSQL query.
string(optional) ane of ARRAY_A | ARRAY_N | OBJECT | OBJECT_K | ARRAY_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 and ARRAY_K, return an associative array of row objects keyed by the value of each row's first column's value. Duplicate keys are discarded.
mixedDatabase query resultsget_row(string|null $query= null, string $output= OBJECT, integer $y= 0) : mixed
Executes a SQL query and returns the row from the SQL result.
| since | 1.0 |
|---|
stringnullSQL query.
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.
integer(optional) Row to return. Indexed from 0.
mixedDatabase query result in format specifed by $outputget_table_from_query(string $q) : string
stringquery
stringtableget_var(string|null $query= null, integer $x= 0, integer $y= 0) : string
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 | 1.0 |
|---|
stringnullSQL query. If null, use the result from the previous query.
integer(optional) Column of value to return. Indexed from 0.
integer(optional) Row of value to return. Indexed from 0.
stringDatabase query resulthas_cap(string $db_cap, false|string|resource $dbh_or_table = false) : boolean
| since | 1.0 |
|---|
stringthe feature
falsestringresourceWhich database to test. False = the currently selected database, string = the database containing the specified table, resource = the database corresponding to the specified mysql resource.
booleanhide_errors() : boolean
| since | 1.0 |
|---|
booleanWhether showing of errors was active or notinsert(string $table, array $data, array|string $format = null) : integer | false
wpdb::insert( 'table', array( 'column' => 'foo', 'field' => 1337 ), array( '%s', '%d' ) )
| since | 1.0 |
|---|---|
| see |
stringtable name
arrayData to insert (in column => value pairs). Both $data columns and $data values should be "raw" (neither should be SQL escaped).
arraystring(optional) An array of formats to be mapped to each of the value in $data. If string, that format will be used for all of the values in $data. A format is one of '%d', '%s' (decimal number, string). If omitted, all values in $data will be treated as strings.
integerfalseThe number of rows inserted, or false on error.prepare(string $query = null) : null | 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 argument numbering/swapping.
May be called like sprintf() or like 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 )
| link | Description of syntax. |
|---|---|
| since | 1.0 |
stringQuery statement with sprintf()-like placeholders
nullstringSanitized query stringprint_error(string $str = '') : boolean
| since | 1.0 |
|---|
stringThe error to display
booleanFalse if the showing of errors is disabled.query(string $query, $use_current = false) : integer | false
More information can be found on the codex page.
| since | 1.0 |
|---|
string
integerfalseNumber of rows affected/selected or false on errorselect(string $db, $dbh) : boolean
The database name will be changed based on the current database connection. On failure, the execution will bail and display an DB error.
| since | 1.0 |
|---|
stringMySQL database name
booleanTrue on success, false on failure.set_prefix(string $prefix, false | array $tables = false) : string
| inherited_from | \BPDB::set_prefix() |
|---|
stringprefix
falsearraytables (optional: false) table identifiers are array keys array values empty: set prefix: array( 'posts' => false, 'users' => false, ... ) string: set to that array value: array( 'posts' => 'my_posts', 'users' => 'my_users' ) array: array[0] is DB identifier, array[1] is table name: array( 'posts' => array( 'global', 'my_posts' ), 'users' => array( 'users', 'my_users' ) ) OR array values (with numeric keys): array( 'posts', 'users', ... )
stringthe previous prefix (mostly only meaningful if all $table parameter was false)set_prefix(string $prefix, false | array $tables = false) : string
| since | 1.0 |
|---|
stringprefix
falsearraytables (optional: false) table identifiers are array keys array values empty: set prefix: array( 'posts' => false, 'users' => false, ... ) string: set to that array value: array( 'posts' => 'my_posts', 'users' => 'my_users' ) OR array values (with numeric keys): array( 'posts', 'users', ... )
stringthe previous prefix (mostly only meaningful if all $table parameter was false)show_errors(boolean $show = true) : boolean
This function should be used only to enable showing of errors. bpdb::hide_errors() should be used instead for hiding of errors. However, this function can be used to enable and disable showing of database errors.
| since | 1.0 |
|---|
booleanWhether to show or hide errors
booleanOld value for showing errors.supports_collation() : boolean
Called when BackPress is generating the table scheme.
| since | 1.0 |
|---|
booleanTrue if collation is supported, false if version does notsuppress_errors(boolean $suppress = true) : boolean
| since | 1.0 |
|---|
boolean
booleanprevious settingtimer_start() : true
| since | 1.0 |
|---|
truetimer_stop() : integer
| since | 1.0 |
|---|
integerTotal time spent on the query, in millisecondsupdate(string $table, array $data, array $where, array|string $format= null, $where_format= null) : integer | false
wpdb::update( 'table', array( 'column' => 'foo', 'field' => 1337 ), array( 'ID' => 1 ), array( '%s', '%d' ), array( '%d' ) )
| since | 1.0 |
|---|---|
| see |
stringtable name
arrayData to update (in column => value pairs). Both $data columns and $data values should be "raw" (neither should be SQL escaped).
arrayA 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".
arraystring(optional) An array of formats to be mapped to each of the values in $data. If string, that format will be used for all of the values in $data. A format is one of '%d', '%s' (decimal number, string). If omitted, all values in $data will be treated as strings.
integerfalseThe number of rows updated, or false on error.$_force_dbhname
false$col_info : array
array()| since | 1.0 |
|---|---|
| access | private |
$db_servers
array()$db_tables
array()$dbh : boolean | resource
false| since | 1.0 |
|---|---|
| access | private |
$dbhs : array
array()$last_error : string
''| since | 1.0 |
|---|
$last_query : string
null| since | 1.0 |
|---|---|
| access | private |
$last_table
''$num_queries : integer
0| since | 1.0 |
|---|---|
| access | private |
$prefix : string
''You can set this to have multiple installations in a single database. The second reason is for possible security precautions.
| since | 1.0 |
|---|---|
| access | private |
$queries : array
array()| since | 1.0 |
|---|---|
| access | private |
$ready : boolean
false| since | 1.0 |
|---|---|
| access | private |
$real_escape : boolean
false| since | 1.0 |
|---|---|
| access | public |
$save_queries : boolean
false| since | 1.0 |
|---|---|
| access | private |
$show_errors : boolean
false| since | 1.0 |
|---|---|
| access | private |
$suppress_errors : boolean
false| access | private |
|---|---|
| since | 1.0 |
$tables : array
array()| since | 1.0 |
|---|---|
| access | private |