protected function Connection::doCommit in Drupal 9
Same name in this branch
- 9 core/lib/Drupal/Core/Database/Connection.php \Drupal\Core\Database\Connection::doCommit()
- 9 core/lib/Drupal/Core/Database/Driver/mysql/Connection.php \Drupal\Core\Database\Driver\mysql\Connection::doCommit()
Do the actual commit, invoke post-commit callbacks.
@internal
Overrides Connection::doCommit
1 call to Connection::doCommit()
- Connection::popCommittableTransactions in core/
lib/ Drupal/ Core/ Database/ Driver/ mysql/ Connection.php - Overridden to work around issues to MySQL not supporting transactional DDL.
File
- core/
lib/ Drupal/ Core/ Database/ Driver/ mysql/ Connection.php, line 466
Class
- Connection
- MySQL implementation of \Drupal\Core\Database\Connection.
Namespace
Drupal\Core\Database\Driver\mysqlCode
protected function doCommit() {
// MySQL will automatically commit transactions when tables are altered or
// created (DDL transactions are not supported). Prevent triggering an
// exception in this case as all statements have been committed.
if ($this->connection
->inTransaction()) {
// On PHP 7 $this->connection->inTransaction() will return TRUE and
// $this->connection->commit() does not throw an exception.
$success = parent::doCommit();
}
else {
// Process the post-root (non-nested) transaction commit callbacks. The
// following code is copied from
// \Drupal\Core\Database\Connection::doCommit()
$success = TRUE;
if (!empty($this->rootTransactionEndCallbacks)) {
$callbacks = $this->rootTransactionEndCallbacks;
$this->rootTransactionEndCallbacks = [];
foreach ($callbacks as $callback) {
call_user_func($callback, $success);
}
}
}
return $success;
}