1. 1.20.x drivers/database_mysql/database.inc
  2. 1.20.x includes/database/database.inc

Core systems for the database layer.

Classes required for basic functioning of the database system should be placed in this file. All utility functions should also be placed in this file only, as they cannot auto-load the way classes can.

File

includes/database/database.inc

Functions

Namesort ascending Description
db_xor Returns a new DatabaseCondition, set to "XOR" all conditions together.
db_update Returns a new UpdateQuery object for the active database.
db_truncate Returns a new TruncateQuery object for the active database.
db_transaction Returns a new transaction object for the active database.
db_table_exists Checks if a table exists.
db_set_active Sets a new active database.
db_select Returns a new SelectQuery object for the active database.
db_rename_table Renames a table.
db_query_temporary Executes a SELECT query string and saves the result set to a temporary table.
db_query_range Executes a query against the active database, restricted to a range.
db_query Executes an arbitrary query string against the active database.
db_parse_url Parses the database URL.
db_or Returns a new DatabaseCondition, set to "OR" all conditions together.
db_next_id Retrieves a unique id.
db_merge Returns a new MergeQuery object for the active database.
db_like Escapes characters that work as wildcard characters in a LIKE pattern.
db_insert Returns a new InsertQuery object for the active database.
db_index_exists Checks if an index exists in the given table.
db_ignore_slave Sets a session variable specifying the lag time for ignoring a slave server.
db_find_tables Finds all tables that are like the specified base table name.
db_find_prefixed_tables Finds all tables that are like the specified base table name. This is a backport of the change made to db_find_tables in Drupal 8 to work with virtual, un-prefixed table names. The original function is retained for Backwards Compatibility.
db_field_set_no_default Sets a field to have no default value.
db_field_set_default Sets the default value for a field.
db_field_names Returns an array of field names from an array of key/index column specifiers.
db_field_exists Checks if a column exists in the given table.
db_escape_table Restricts a dynamic table name to safe characters.
db_escape_field Restricts a dynamic column or constraint name to safe characters.
db_drop_unique_key Drops a unique key.
db_drop_table Drops a table.
db_drop_primary_key Drops the primary key of a database table.
db_drop_index Drops an index.
db_drop_field Drops a field.
db_driver Retrieves the name of the currently active database driver.
db_delete Returns a new DeleteQuery object for the active database.
db_create_table Creates a new table from a Backdrop table definition.
_db_create_keys_sql
db_condition Returns a new DatabaseCondition, set to the specified conjunction.
db_close Closes the active database connection.
db_change_field Changes a field definition.
db_and Returns a new DatabaseCondition, set to "AND" all conditions together.
db_add_unique_key Adds a unique key.
db_add_primary_key Adds a primary key to a database table.
db_add_index Adds an index.
db_add_field Adds a new field to a table.

Classes

Namesort ascending Description
NoFieldsException Exception thrown if an insert query doesn't specify insert or default fields.
InvalidMergeQueryException Exception thrown for merge queries that do not make semantic sense.
FieldsOverlapException Exception thrown if an insert query specifies a field twice.
DatabaseTransactionOutOfOrderException Exception thrown when a rollback() resulted in other active transactions being rolled-back.
DatabaseTransactionNoActiveException Exception for when popTransaction() is called with no active transaction.
DatabaseTransactionNameNonUniqueException Exception thrown when a savepoint or transaction name occurs twice.
DatabaseTransactionExplicitCommitNotAllowedException Exception to deny attempts to explicitly manage transactions.
DatabaseTransactionCommitFailedException Exception thrown when a commit() function fails.
DatabaseTransaction A wrapper class for creating and managing database transactions.
DatabaseStatementEmpty Empty implementation of a database statement.
DatabaseStatementBase Default implementation of DatabaseStatementInterface.
DatabaseNotFoundException Exception thrown when the specified database cannot be found.
DatabaseDriverNotSpecifiedException Exception thrown if no driver is specified for a database connection.
DatabaseConnectionNotDefinedException Exception thrown if an undefined database connection is requested.
DatabaseConnection Base Database API class.
Database Primary front-controller for the database system.

Interfaces

Namesort ascending Description
DatabaseStatementInterface Represents a prepared statement.