Метод |
Описание |
|
begin_transaction ( ) |
Start a transaction against the RDBMS in order to wrap multiple
statements in a safe ACID-compliant container |
|
clear_errors ( ) |
Updates the last error pointer to simulate resetting the error array |
|
commit ( ) |
Commit a currently running transaction |
|
connect ( ) : boolean |
Connects to the database server. If no arguments are
supplied, then the connection is attempted for the
database authentication variables in config.php. |
|
dbdelta ( array $queries, boolean $execute = true, boolean $silent = true, boolean $doinserts = false ) : string |
Automatic database diffing function, used for determining required database upgrades. |
|
delete ( string $table, array $keyfields ) : boolean |
Deletes any record that matches the specific criteria |
|
disconnect ( ) |
|
|
exec ( string $query ) : boolean |
Execute the given query on the database. Encapsulates PDO::exec. |
|
execute_procedure ( string $procedure, array $args = [] ) : mixed |
Executes a stored procedure against the database |
|
exists ( string $table, array $keyfieldvalues ) : boolean |
Checks for a record that matches the specific criteria |
|
get_column ( string $query, array $args = [] ) : array |
Returns all values for a column for a query |
|
get_driver_name ( ) : mixed |
|
|
get_driver_version ( ) : mixed |
|
|
get_errors ( ) : array |
Returns error data gathered from database connection |
|
get_keyvalue ( string $query, array $args = [] ) : array |
Returns an associative array using the first returned column as the array key and the second as the array value |
|
get_last_error ( ) : array |
Returns only the last error info |
|
get_profiles ( ) : array |
Returns query profiles |
|
get_results ( string $query, array $args = [], null | string $class_name = '\Habari\QueryRecord' ) : array |
Execute a query and return the results as an array of objects |
|
get_row ( string $query, array $args = [], string $class_name = '\Habari\QueryRecord' ) : object |
Returns a single row (the first in a multi-result set) object for a query |
|
get_value ( string $query, array $args = [] ) : mixed |
Return a single value from the database |
|
has_errors ( ) : boolean |
Determines if there have been errors since the last clear_errors() call |
|
in_transaction ( ) : boolean |
Check whether there is a transaction underway. |
|
insert ( string $table, array $fieldvalues ) : boolean |
Inserts into the specified table values associated to the key fields |
|
is_connected ( ) : boolean |
Check whether there is an existing connection to a database. |
|
last_insert_id ( ) : mixed |
Helper function to return the last inserted sequence or
auto_increment field. Useful when doing multiple inserts
within a single transaction -- for example, adding dependent
related rows. |
|
list_tables ( ) : array |
Returns a list of tables the DB currently knows about. |
|
query ( string $query, array $args = [] ) : boolean |
Queries the database for a given SQL command. |
|
quote ( string $string ) : string |
Return a PDO-quoted string appropriate for the DB backend we're using. |
|
register_table ( string $name ) |
Adds a table to the list of tables known to Habari. Used
by Theme and Plugin classes to inform the DB class about
custom tables used by the plugin |
|
rollback ( ) |
Rolls a currently running transaction back to the
prexisting state, or, if the RDBMS supports it, whenever
a savepoint was committed. |
|
row_count ( ) : integer |
Returns number of rows affected by the last DELETE, INSERT, or UPDATE |
|
set_fetch_class ( string $class_name ) |
Sets the class to fetch, if fetch mode is PDO::FETCH_CLASS |
|
set_fetch_mode ( integer $mode ) |
Sets the fetch mode for return calls from PDOStatement |
|
table ( string $name ) : string |
Helper function to naturally return table names |
|
update ( string $table, array $fieldvalues, array $keyfields ) : boolean |
function update
Updates any record that matches the specific criteria
A new row is inserted if no existing record matches the criteria |
|
upgrade ( integer $old_version ) : boolean |
Upgrade data in the database between database revisions |
|
upgrade_post ( $old_version ) |
|
|
upgrade_pre ( $old_version ) |
|
|