function StatementPrefetchIterator::throwPDOException

Throw a PDO Exception based on the last PDO error.

Deprecated

in drupal:10.3.0 and is removed from drupal:11.0.0. There is no replacement.

See also

https://www.drupal.org/node/3410663

File

core/lib/Drupal/Core/Database/StatementPrefetchIterator.php, line 172

Class

StatementPrefetchIterator
An implementation of StatementInterface that prefetches all data.

Namespace

Drupal\Core\Database

Code

protected function throwPDOException() : void {
    @trigger_error(__METHOD__ . '() is deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. There is no replacement. See https://www.drupal.org/node/3410663', E_USER_DEPRECATED);
    $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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.