| Versionen | |
|---|---|
| drupal7 | protected DatabaseConnection::prepareQuery($query, $cache = TRUE) |
Prepare a query string and return the prepared statement.
This method caches prepared statements, reusing them when possible. It also prefixes tables names enclosed in curly-braces.
$query The query string as SQL, with curly-braces surrounding the table names.
$cache Whether or not to cache the prepared statement for later reuse in this same request. Usually we want to, but queries that require preprocessing cannot be safely cached.
A PDO prepared statement ready for its execute() method.
includes/
<?php
protected function prepareQuery($query, $cache = TRUE) {
$query = $this->prefixTables($query);
if (empty($this->preparedStatements[$query])) {
// Call PDO::prepare.
$this->preparedStatements[$query] = parent::prepare($query);
}
return $this->preparedStatements[$query];
}
?>
Kommentare
Kommentar hinzufügen