1 database.inc public DatabaseConnection::prefixTables($sql)

Appends a database prefix to all tables in a query.

Queries sent to Backdrop should wrap all table names in curly brackets. This function searches for this syntax and adds Backdrop's table prefix to all tables, allowing Backdrop 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.

File

core/includes/database/database.inc, line 456
Core systems for the database layer.

Class

DatabaseConnection
Base Database API class.

Code

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