public function Connection::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.

2 calls to Connection::prefixTables()
Connection::makeSequenceName in drupal/core/lib/Drupal/Core/Database/Connection.php
Creates the appropriate sequence name for a given table and serial field.
Connection::prepareQuery in drupal/core/lib/Drupal/Core/Database/Connection.php
Prepares a query string and returns the prepared statement.

File

drupal/core/lib/Drupal/Core/Database/Connection.php, line 304
Definition of Drupal\Core\Database\Connection

Class

Connection
Base Database API class.

Namespace

Drupal\Core\Database

Code

public function prefixTables($sql) {
  return str_replace($this->prefixSearch, $this->prefixReplace, $sql);
}