You are here

public function Transaction::commit in Drupal driver for SQL Server and SQL Azure 8.2

Same name and namespace in other branches
  1. 8 drivers/lib/Drupal/Driver/Database/sqlsrv/Transaction.php \Drupal\Driver\Database\sqlsrv\Transaction::commit()

Commits the transaction. Only available for SANE transactions.

Throws

DatabaseTransactionExplicitCommitNotAllowedException

File

drivers/lib/Drupal/Driver/Database/sqlsrv/Transaction.php, line 85
Definition of Drupal\Driver\Database\sqlsrv\Transaction

Class

Transaction

Namespace

Drupal\Driver\Database\sqlsrv

Code

public function commit() {

  // Insane transaction behaviour does not allow explicit commits.
  if (!$this->settings
    ->Get_Sane()) {
    throw new DatabaseTransactionExplicitCommitNotAllowedException();
  }

  // Cannot commit a rolledback transaction...
  if ($this->rolledBack) {
    throw new DatabaseTransactionCannotCommitAfterRollbackException();
  }

  // Mark as commited, and commit!
  $this->commited = true;

  // Finally pop it!
  $this->connection
    ->popTransaction($this->name);
}