public function DatabaseConnection::prepareQuery

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

includes/database/database.inc, line 479
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 parent::prepare($query);
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!database!database.inc/function/DatabaseConnection::prepareQuery/7.x