You are here

public function DatabaseTransaction_sqlsrv::commit in Drupal driver for SQL Server and SQL Azure 7.2

Same name and namespace in other branches
  1. 7.3 sqlsrv/transaction.inc \DatabaseTransaction_sqlsrv::commit()

The "sane" behaviour requires explicit commits.

Throws

DatabaseTransactionExplicitCommitNotAllowedException

File

sqlsrv/transaction.inc, line 78

Class

DatabaseTransaction_sqlsrv
Overriden to bring some commonsense to transaction management.

Code

public function commit() {
  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;
  $this->connection
    ->popTransaction($this->name);
}