function DatabaseConnection_sqlite::popTransaction

Overrides DatabaseConnection::popTransaction

File

includes/database/sqlite/database.inc, line 373

Class

DatabaseConnection_sqlite
Specific SQLite implementation of DatabaseConnection.

Code

public function popTransaction($name) {
    if ($this->savepointSupport) {
        return parent::popTransaction($name);
    }
    if (!$this->supportsTransactions()) {
        return;
    }
    if (!$this->inTransaction()) {
        throw new DatabaseTransactionNoActiveException();
    }
    // Commit everything since SAVEPOINT $name.
    while ($savepoint = array_pop($this->transactionLayers)) {
        if ($savepoint != $name) {
            continue;
        }
        // If there are no more layers left then we should commit or rollback.
        if (empty($this->transactionLayers)) {
            // If there was any rollback() we should roll back whole transaction.
            if ($this->willRollback) {
                $this->willRollback = FALSE;
                $this->connection
                    ->rollBack();
            }
            elseif (!$this->connection
                ->commit()) {
                throw new DatabaseTransactionCommitFailedException();
            }
        }
        else {
            break;
        }
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.