W3cubDocs

/Drupal 8

protected function StatementPrefetch::throwPDOException

protected StatementPrefetch::throwPDOException()

Throw a PDO Exception based on the last PDO error.

File

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

Class

StatementPrefetch
An implementation of StatementInterface that prefetches all data.

Namespace

Drupal\Core\Database

Code

protected function throwPDOException() {
  $error_info = $this->dbh->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;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Database!StatementPrefetch.php/function/StatementPrefetch::throwPDOException/8.1.x