You are here

protected function StatementPrefetch::throwPDOException in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Database/StatementPrefetch.php \Drupal\Core\Database\StatementPrefetch::throwPDOException()
  2. 9 core/lib/Drupal/Core/Database/StatementPrefetch.php \Drupal\Core\Database\StatementPrefetch::throwPDOException()

Throw a PDO Exception based on the last PDO error.

1 call to StatementPrefetch::throwPDOException()
StatementPrefetch::execute in core/lib/Drupal/Core/Database/StatementPrefetch.php
Executes a prepared statement.

File

core/lib/Drupal/Core/Database/StatementPrefetch.php, line 224

Class

StatementPrefetch
An implementation of StatementInterface that prefetches all data.

Namespace

Drupal\Core\Database

Code

protected function throwPDOException() {
  $error_info = $this->connection
    ->errorInfo();

  // We rebuild a message formatted in the same way as PDO.
  $exception = new \PDOException("SQLSTATE[" . $error_info[0] . "]: General error " . $error_info[1] . ": " . $error_info[2]);
  $exception->errorInfo = $error_info;
  throw $exception;
}