You are here

public function Connection::prepare in Zircon Profile 8

Same name in this branch
  1. 8 core/lib/Drupal/Core/Database/Connection.php \Drupal\Core\Database\Connection::prepare()
  2. 8 core/lib/Drupal/Core/Database/Driver/sqlite/Connection.php \Drupal\Core\Database\Driver\sqlite\Connection::prepare()
Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Database/Driver/sqlite/Connection.php \Drupal\Core\Database\Driver\sqlite\Connection::prepare()

Prepares a statement for execution and returns a statement object

Emulated prepared statements does not communicate with the database server so this method does not check the statement.

Parameters

string $statement: This must be a valid SQL statement for the target database server.

array $driver_options: (optional) This array holds one or more key=>value pairs to set attribute values for the PDOStatement object that this method returns. You would most commonly use this to set the \PDO::ATTR_CURSOR value to \PDO::CURSOR_SCROLL to request a scrollable cursor. Some drivers have driver specific options that may be set at prepare-time. Defaults to an empty array.

Return value

\PDOStatement|false If the database server successfully prepares the statement, returns a \PDOStatement object. If the database server cannot successfully prepare the statement returns FALSE or emits \PDOException (depending on error handling).

Throws

\PDOException

Overrides Connection::prepare

See also

\PDO::prepare()

1 call to Connection::prepare()
Connection::prepareQuery in core/lib/Drupal/Core/Database/Driver/sqlite/Connection.php
Prepares a query string and returns the prepared statement.

File

core/lib/Drupal/Core/Database/Driver/sqlite/Connection.php, line 306
Contains \Drupal\Core\Database\Driver\sqlite\Connection.

Class

Connection
SQLite implementation of \Drupal\Core\Database\Connection.

Namespace

Drupal\Core\Database\Driver\sqlite

Code

public function prepare($statement, array $driver_options = array()) {
  return new Statement($this->connection, $this, $statement, $driver_options);
}