protected function Statement::throwPDOException in Drupal driver for SQL Server and SQL Azure 8
Throw a PDO Exception based on the last PDO error.
@status: Unfinished.
1 call to Statement::throwPDOException()
- Statement::execute in drivers/
lib/ Drupal/ Driver/ Database/ sqlsrv/ Statement.php - Executes a prepared statement
File
- drivers/
lib/ Drupal/ Driver/ Database/ sqlsrv/ Statement.php, line 118 - Definition of Drupal\Driver\Database\sqlsrv\Statement
Class
Namespace
Drupal\Driver\Database\sqlsrvCode
protected function throwPDOException(&$statement = NULL) {
// This is what a SQL Server PDO "no error" looks like.
$null_error = array(
0 => '00000',
1 => NULL,
2 => NULL,
);
// The implementation in Drupal's Core StatementPrefetch Class
// takes for granted that the error information is in the PDOConnection
// but it is regularly held in the PDOStatement.
$error_info_connection = $this->dbh
->errorInfo();
$error_info_statement = !empty($statement) ? $statement
->errorInfo() : $null_error;
// TODO: Concatenate error information when both connection
// and statement error info are valid.
// We rebuild a message formatted in the same way as PDO.
$error_info = $error_info_connection === $null_error ? $error_info_statement : $error_info_connection;
$exception = new PDOException("SQLSTATE[" . $error_info[0] . "]: General error " . $error_info[1] . ": " . $error_info[2]);
$exception->errorInfo = $error_info;
unset($statement);
throw $exception;
}