package | BackPress |
---|
BPDB() : \unknown
since | 1.0 |
---|
\unknown
Returns the result of bpdb::__construct()__construct() : void
Grabs the arguments, calls bpdb::_init() and then connects to the database
since | 1.0 |
---|
__destruct() : boolean
since | 1.0 |
---|
boolean
Always returns true_escape($data)
_init(array $args) : array
since | 1.0 |
---|
array
The provided connection settings
array
The current connection settings after processing by init_real_escape($string)
_weak_escape($string)
bail(string $message) : false | void
Will not die if bpdb::$show_errors is true
since | 1.0 |
---|
string
false
void
check_database_version($dbh_or_table = false
) : \WP_Error
since | 1.0 |
---|
\WP_Error
db_connect(string $query = ''
) : resource
since | 1.0 |
---|
string
query
resource
mysql database connectiondb_connect_host(array $args) : void | boolean
since | 1.0 |
---|
array
args 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)
void
boolean
void if cannot connect, false if cannot select, true if successdb_version(false|string|resource $dbh_or_table = false
) : false | string
since | 1.0 |
---|
false
string
resource
Which database to test. False = the currently selected database, string = the database containing the specified table, resource = the database corresponding to the specified mysql resource.
false
string
false on failure, version number on successescape(string|array $data) : string
since | 1.0 |
---|
string
array
string
query 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 |
---|
string
The 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 |
---|
string
null
SQL query. If null, use the result from the previous query.
integer
Column to return. Indexed from 0.
array
Database 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 |
---|
string
one of name, table, def, max_length, not_null, primary_key, multiple_key, unique_key, numeric, blob, type, unsigned, zerofill
integer
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 Resultsget_error(string $str = ''
)
since | 1.0 |
---|
string
Error string
get_results(string $query= null
, string $output= OBJECT
) : mixed
Executes a SQL query and returns the entire SQL result.
since | 1.0 |
---|
string
SQL 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.
mixed
Database 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 |
---|
string
null
SQL 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.
mixed
Database query result in format specifed by $outputget_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 |
---|
string
null
SQL 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.
string
Database query resulthas_cap(string $db_cap, false|string|resource $dbh_or_table = false
) : boolean
since | 1.0 |
---|
string
the feature
false
string
resource
Which database to test. False = the currently selected database, string = the database containing the specified table, resource = the database corresponding to the specified mysql resource.
boolean
hide_errors() : boolean
since | 1.0 |
---|
boolean
Whether 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 |
string
table name
array
Data to insert (in column => value pairs). Both $data columns and $data values should be "raw" (neither should be SQL escaped).
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', '%s' (decimal number, string). If omitted, all values in $data will be treated as strings.
integer
false
The 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 |
string
Query statement with sprintf()-like placeholders
null
string
Sanitized query stringprint_error(string $str = ''
) : boolean
since | 1.0 |
---|
string
The error to display
boolean
False 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
integer
false
Number 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 |
---|
string
MySQL database name
boolean
True on success, false on failure.set_prefix(string $prefix, false | array $tables = false
) : string
since | 1.0 |
---|
string
prefix
false
array
tables (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', ... )
string
the 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 |
---|
boolean
Whether to show or hide errors
boolean
Old value for showing errors.supports_collation() : boolean
Called when BackPress is generating the table scheme.
since | 1.0 |
---|
boolean
True if collation is supported, false if version does notsuppress_errors(boolean $suppress = true
) : boolean
since | 1.0 |
---|
boolean
boolean
previous settingtimer_start() : true
since | 1.0 |
---|
true
timer_stop() : integer
since | 1.0 |
---|
integer
Total 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 |
string
table name
array
Data to update (in column => value pairs). Both $data columns and $data values should be "raw" (neither should be SQL escaped).
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".
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', '%s' (decimal number, string). If omitted, all values in $data will be treated as strings.
integer
false
The number of rows updated, or false on error.$col_info : array
array()
since | 1.0 |
---|---|
access | private |
$dbh : boolean | resource
false
since | 1.0 |
---|---|
access | private |
$last_error : string
''
since | 1.0 |
---|
$last_query : string
null
since | 1.0 |
---|---|
access | private |
$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 |