Connection::prepareQuery

public Connection::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

\Drupal\Core\Database\StatementInterface A PDO prepared statement ready for its execute() method.

File

core/lib/Drupal/Core/Database/Connection.php, line 386

Class

Connection
Base Database API class.

Namespace

Drupal\Core\Database

Code

1
2
3
4
5
public function prepareQuery($query) {
  $query = $this->prefixTables($query);
 
  return $this->connection->prepare($query);
}
doc_Drupal
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.