DatabaseConnection::prefixTables

  1. drupal
    1. 8
    2. 7
Versions
7 public DatabaseConnection::prefixTables($sql)

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.

Code

includes/database/database.inc, line 428

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