function Statement::execute
Overrides StatementPrefetchIterator::execute
File
-
core/
modules/ sqlite/ src/ Driver/ Database/ sqlite/ Statement.php, line 88
Class
- Statement
- SQLite implementation of \Drupal\Core\Database\Statement.
Namespace
Drupal\sqlite\Driver\Database\sqliteCode
public function execute($args = [], $options = []) {
if (isset($options['fetch']) && is_int($options['fetch'])) {
@trigger_error("Passing the 'fetch' key as an integer to \$options in execute() is deprecated in drupal:11.2.0 and is removed from drupal:12.0.0. Use a case of \\Drupal\\Core\\Database\\Statement\\FetchAs enum instead. See https://www.drupal.org/node/3488338", E_USER_DEPRECATED);
}
try {
$return = parent::execute($args, $options);
} catch (\PDOException $e) {
// 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) {
// The schema has changed. SQLite specifies that we must resend the
// query.
$return = parent::execute($args, $options);
}
else {
// Rethrow the exception.
throw $e;
}
}
return $return;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.