1 database.inc public DatabaseConnection::prepareQuery($query)

Prepares a query string and returns the prepared statement.

This method caches prepared statements, reusing them when possible. It also prefixes tables names enclosed in curly-braces.

Parameters

$query: The query string as SQL, with curly-braces surrounding the table names.

Return value

DatabaseStatementInterface: A PDO prepared statement ready for its execute() method.

File

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

Class

DatabaseConnection
Base Database API class.

Code

public function prepareQuery($query) {
  $query = $this->prefixTables($query);

  // Call PDO::prepare.
  return $this->pdo->prepare($query);
}