function DatabaseConnection_sqlite::rollback

Overrides DatabaseConnection::rollback

File

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

Class

DatabaseConnection_sqlite
Specific SQLite implementation of DatabaseConnection.

Code

public function rollback($savepoint_name = 'drupal_transaction') {
    if ($this->savepointSupport) {
        return parent::rollBack($savepoint_name);
    }
    if (!$this->inTransaction()) {
        throw new DatabaseTransactionNoActiveException();
    }
    // A previous rollback to an earlier savepoint may mean that the savepoint
    // in question has already been rolled back.
    if (!in_array($savepoint_name, $this->transactionLayers)) {
        return;
    }
    // We need to find the point we're rolling back to, all other savepoints
    // before are no longer needed.
    while ($savepoint = array_pop($this->transactionLayers)) {
        if ($savepoint == $savepoint_name) {
            // Mark whole stack of transactions as needed roll back.
            $this->willRollback = TRUE;
            // If it is the last the transaction in the stack, then it is not a
            // savepoint, it is the transaction itself so we will need to roll back
            // the transaction rather than a savepoint.
            if (empty($this->transactionLayers)) {
                break;
            }
            return;
        }
    }
    if ($this->supportsTransactions()) {
        $this->connection
            ->rollBack();
    }
}

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