function Connection::handleQueryException
Same name in this branch
- 9 core/modules/mysql/src/Driver/Database/mysql/Connection.php \Drupal\mysql\Driver\Database\mysql\Connection::handleQueryException()
- 9 core/lib/Drupal/Core/Database/Connection.php \Drupal\Core\Database\Connection::handleQueryException()
Same name and namespace in other branches
- 8.9.x core/lib/Drupal/Core/Database/Driver/sqlite/Connection.php \Drupal\Core\Database\Driver\sqlite\Connection::handleQueryException()
- 8.9.x core/lib/Drupal/Core/Database/Connection.php \Drupal\Core\Database\Connection::handleQueryException()
Wraps and re-throws any PDO exception thrown by static::query().
Parameters
\PDOException $e: The exception thrown by static::query().
$query: The query executed by static::query().
array $args: An array of arguments for the prepared statement.
array $options: An associative array of options to control how the query is run.
Return value
\Drupal\Core\Database\StatementInterface|int|null Most database drivers will return NULL when a PDO exception is thrown for a query, but some of them may need to re-run the query, so they can also return a \Drupal\Core\Database\StatementInterface object or an integer.
Overrides Connection::handleQueryException
File
-
core/
modules/ sqlite/ src/ Driver/ Database/ sqlite/ Connection.php, line 372
Class
- Connection
- SQLite implementation of \Drupal\Core\Database\Connection.
Namespace
Drupal\sqlite\Driver\Database\sqliteCode
protected function handleQueryException(\PDOException $e, $query, array $args = [], $options = []) {
// The database schema might be changed by another process in between the
// time that the statement was prepared and the time the statement was run
// (e.g. usually happens when running tests). In this case, we need to
// re-run the query.
// @see http://www.sqlite.org/faq.html#q15
// @see http://www.sqlite.org/rescode.html#schema
if (!empty($e->errorInfo[1]) && $e->errorInfo[1] === 17) {
@trigger_error('Connection::handleQueryException() is deprecated in drupal:9.2.0 and is removed in drupal:10.0.0. Get a handler through $this->exceptionHandler() instead, and use one of its methods. See https://www.drupal.org/node/3187222', E_USER_DEPRECATED);
return $this->query($query, $args, $options);
}
parent::handleQueryException($e, $query, $args, $options);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.