You are here

public function Connection::prepareStatement in Drupal 10

Same name in this branch
  1. 10 core/modules/sqlite/src/Driver/Database/sqlite/Connection.php \Drupal\sqlite\Driver\Database\sqlite\Connection::prepareStatement()
  2. 10 core/modules/pgsql/src/Driver/Database/pgsql/Connection.php \Drupal\pgsql\Driver\Database\pgsql\Connection::prepareStatement()
1 call to Connection::prepareStatement()
Connection::nextId in core/modules/sqlite/src/Driver/Database/sqlite/Connection.php

File

core/modules/sqlite/src/Driver/Database/sqlite/Connection.php, line 386

Class

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

Namespace

Drupal\sqlite\Driver\Database\sqlite

Code

public function prepareStatement(string $query, array $options, bool $allow_row_count = FALSE) : StatementInterface {
  if (isset($options['return'])) {
    @trigger_error('Passing "return" option to ' . __METHOD__ . '() is deprecated in drupal:9.4.0 and is removed in drupal:11.0.0. For data manipulation operations, use dynamic queries instead. See https://www.drupal.org/node/3185520', E_USER_DEPRECATED);
  }
  try {
    $query = $this
      ->preprocessStatement($query, $options);
    $statement = new Statement($this->connection, $this, $query, $options['pdo'] ?? [], $allow_row_count);
  } catch (\Exception $e) {
    $this
      ->exceptionHandler()
      ->handleStatementException($e, $query, $options);
  }
  return $statement;
}