function DatabaseConnection::prepareQuery

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.

2 calls to DatabaseConnection::prepareQuery()
DatabaseConnection::query in includes/database/database.inc
Executes a query string against the database.
DatabaseConnection_pgsql::prepareQuery in includes/database/pgsql/database.inc
Prepares a query string and returns the prepared statement.
2 methods override DatabaseConnection::prepareQuery()
DatabaseConnection_pgsql::prepareQuery in includes/database/pgsql/database.inc
Prepares a query string and returns the prepared statement.
DatabaseConnection_sqlite::prepareQuery in includes/database/sqlite/database.inc
Prepares a query string and returns the prepared statement.

File

includes/database/database.inc, line 540

Class

DatabaseConnection
Base Database API class.

Code

public function prepareQuery($query) {
    $query = $this->prefixTables($query);
    // Call PDO::prepare.
    return $this->connection
        ->prepare($query);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.