[ Index ] |
PHP Cross Reference of BackPress |
[Source view] [Print] [Project Stats]
(no description)
File Size: | 1164 lines (31 kb) |
Included or required: | 1 time |
Referenced: | 0 times |
Includes or requires: | 0 files |
BPDB:: (37 methods):
BPDB()
__construct()
_init()
__destruct()
db_connect()
db_connect_host()
set_prefix()
select()
_weak_escape()
_real_escape()
_escape()
escape()
escape_by_ref()
escape_deep()
prepare()
get_error()
print_error()
show_errors()
hide_errors()
suppress_errors()
flush()
query()
insert()
update()
get_var()
get_row()
get_col()
get_results()
get_col_info()
timer_start()
timer_stop()
bail()
check_database_version()
supports_collation()
has_cap()
db_version()
get_caller()
BPDB() X-Ref |
PHP4 style constructor since: 1.0 return: unknown Returns the result of bpdb::__construct() |
__construct() X-Ref |
PHP5 style constructor Grabs the arguments, calls bpdb::_init() and then connects to the database since: 1.0 return: void |
_init( $args ) X-Ref |
Initialises the class variables based on provided arguments since: 1.0 return: array The current connection settings after processing by init param: array $args The provided connection settings |
__destruct() X-Ref |
PHP5 style destructor, registered as shutdown function in PHP4 since: 1.0 return: bool Always returns true |
db_connect( $query = '' ) X-Ref |
Figure out which database server should handle the query, and connect to it. since: 1.0 return: resource mysql database connection param: string query |
db_connect_host( $args ) X-Ref |
Connects to the database server and selects a database since: 1.0 return: void|bool void if cannot connect, false if cannot select, true if success param: array args |
set_prefix( $prefix, $tables = false ) X-Ref |
Sets the table prefix for the WordPress tables. since: 1.0 return: string the previous prefix (mostly only meaningful if all $table parameter was false) param: string prefix param: false|array tables (optional: false) |
select( $db, &$dbh ) X-Ref |
Selects a database using the current database connection. 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 return: bool True on success, false on failure. param: string $db MySQL database name |
_weak_escape( $string ) X-Ref |
No description |
_real_escape( $string ) X-Ref |
No description |
_escape( $data ) X-Ref |
No description |
escape( $data ) X-Ref |
Escapes content for insertion into the database using addslashes(), for security since: 1.0 return: string query safe string param: string|array $data |
escape_by_ref( &$string ) X-Ref |
Escapes content by reference for insertion into the database, for security since: 1.0 param: string $s |
escape_deep( $array ) X-Ref |
Escapes array recursively for insertion into the database, for security param: array $array |
prepare( $query = null ) X-Ref |
Prepares a SQL query for safe execution. Uses sprintf()-like syntax. 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 {@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. <code> wpdb::prepare( "SELECT * FROM `table` WHERE `column` = %s AND `field` = %d", "foo", 1337 ) </code> since: 1.0 return: null|string Sanitized query string param: string $query Query statement with sprintf()-like placeholders param: array|mixed $args 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()}. param: mixed $args,... further variables to substitute into the query's placeholders if being called like {@link http://php.net/sprintf sprintf()}. |
get_error( $str = '' ) X-Ref |
Get SQL/DB error since: 1.0 param: string $str Error string |
print_error( $str = '' ) X-Ref |
Print SQL/DB error. since: 1.0 return: bool False if the showing of errors is disabled. param: string $str The error to display |
show_errors( $show = true ) X-Ref |
Enables showing of database errors. 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 return: bool Old value for showing errors. param: bool $show Whether to show or hide errors |
hide_errors() X-Ref |
Disables showing of database errors. since: 1.0 return: bool Whether showing of errors was active or not |
suppress_errors( $suppress = true ) X-Ref |
Whether to suppress database errors. since: 1.0 return: bool previous setting param: bool $suppress |
flush() X-Ref |
Kill cached query results. since: 1.0 |
query( $query, $use_current = false ) X-Ref |
Perform a MySQL database query, using current database connection. More information can be found on the codex page. since: 1.0 return: int|false Number of rows affected/selected or false on error param: string $query |
insert( $table, $data, $format = null ) X-Ref |
Insert a row into a table. <code> wpdb::insert( 'table', array( 'column' => 'foo', 'field' => 1337 ), array( '%s', '%d' ) ) </code> since: 1.0 return: int|false The number of rows inserted, or false on error. param: string $table table name param: array $data Data to insert (in column => value pairs). Both $data columns and $data values should be "raw" (neither should be SQL escaped). param: array|string $format (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. |
update( $table, $data, $where, $format = null, $where_format = null ) X-Ref |
Update a row in the table <code> wpdb::update( 'table', array( 'column' => 'foo', 'field' => 1337 ), array( 'ID' => 1 ), array( '%s', '%d' ), array( '%d' ) ) </code> since: 1.0 return: int|false The number of rows updated, or false on error. param: string $table table name param: array $data Data to update (in column => value pairs). Both $data columns and $data values should be "raw" (neither should be SQL escaped). param: array $where 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". param: array|string $format (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. param: array|string $format_where (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', '%s' (decimal number, string). If omitted, all values in $where will be treated as strings. |
get_var( $query=null, $x = 0, $y = 0 ) X-Ref |
Retrieve one variable from the database. 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 return: string Database query result param: string|null $query SQL query. If null, use the result from the previous query. param: int $x (optional) Column of value to return. Indexed from 0. param: int $y (optional) Row of value to return. Indexed from 0. |
get_row( $query = null, $output = OBJECT, $y = 0 ) X-Ref |
Retrieve one row from the database. Executes a SQL query and returns the row from the SQL result. since: 1.0 return: mixed Database query result in format specifed by $output param: string|null $query SQL query. param: string $output (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. param: int $y (optional) Row to return. Indexed from 0. |
get_col( $query = null , $x = 0 ) X-Ref |
Retrieve one column from the database. 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 return: array Database query result. Array indexed from 0 by SQL result row number. param: string|null $query SQL query. If null, use the result from the previous query. param: int $x Column to return. Indexed from 0. |
get_results( $query = null, $output = OBJECT ) X-Ref |
Retrieve an entire SQL result set from the database (i.e., many rows) Executes a SQL query and returns the entire SQL result. since: 1.0 return: mixed Database query results param: string $query SQL query. param: string $output (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. |
get_col_info( $info_type = 'name', $col_offset = -1 ) X-Ref |
Retrieve column metadata from the last query. since: 1.0 return: mixed Column Results param: string $info_type one of name, table, def, max_length, not_null, primary_key, multiple_key, unique_key, numeric, blob, type, unsigned, zerofill param: int $col_offset 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 |
timer_start() X-Ref |
Starts the timer, for debugging purposes. since: 1.0 return: true |
timer_stop() X-Ref |
Stops the debugging timer. since: 1.0 return: int Total time spent on the query, in milliseconds |
bail( $message ) X-Ref |
Wraps errors in a nice header and footer and dies. Will not die if bpdb::$show_errors is true since: 1.0 return: false|void param: string $message |
check_database_version( $dbh_or_table = false ) X-Ref |
Whether or not MySQL database is at least the required minimum version. since: 1.0 return: WP_Error |
supports_collation() X-Ref |
Whether of not the database supports collation. Called when BackPress is generating the table scheme. since: 1.0 return: bool True if collation is supported, false if version does not |
has_cap( $db_cap, $dbh_or_table = false ) X-Ref |
Generic function to determine if a database supports a particular feature since: 1.0 return: bool param: string $db_cap the feature param: false|string|resource $dbh_or_table 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. |
db_version( $dbh_or_table = false ) X-Ref |
The database version number since: 1.0 return: false|string false on failure, version number on success param: false|string|resource $dbh_or_table 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. |
get_caller() X-Ref |
Retrieve the name of the function that called bpdb. 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 return: string The name of the calling function |
Generated: Fri Dec 6 01:00:55 2024 | Cross-referenced by PHPXref 0.7.1 |