public function DatabaseConnection::prefixTables
Appends a database prefix to all tables in a query.
Queries sent to Drupal should wrap all table names in curly brackets. This function searches for this syntax and adds Drupal's table prefix to all tables, allowing Drupal to coexist with other systems in the same database and/or schema if necessary.
Parameters
$sql: A string containing a partial or entire SQL query.
Return value
The properly-prefixed string.
6 calls to DatabaseConnection::prefixTables()
- DatabaseConnection::makeSequenceName in drupal-7.x/
includes/ database/ database.inc - Creates the appropriate sequence name for a given table and serial field.
- DatabaseConnection::makeSequenceName in drupal-7.x/
includes/ database/ database.inc - Creates the appropriate sequence name for a given table and serial field.
- DatabaseConnection::prepareQuery in drupal-7.x/
includes/ database/ database.inc - Prepares a query string and returns the prepared statement.
- DatabaseConnection::prepareQuery in drupal-7.x/
includes/ database/ database.inc - Prepares a query string and returns the prepared statement.
- DatabaseConnection_sqlite::prepareQuery in drupal-7.x/
includes/ database/ sqlite/ database.inc - Prepares a query string and returns the prepared statement.
Archivo
- drupal-7.x/
includes/ database/ database.inc, line 444 - Core systems for the database layer.
Class
- DatabaseConnection
- Base Database API class.
Código
public function prefixTables($sql) {
return str_replace($this->prefixSearch, $this->prefixReplace, $sql);
}