function DatabaseConnection::pushTransaction

Increases the depth of transaction nesting.

If no transaction is already active, we begin a new transaction.

Throws

DatabaseTransactionNameNonUniqueException

See also

DatabaseTransaction

1 call to DatabaseConnection::pushTransaction()
DatabaseConnection_sqlite::pushTransaction in includes/database/sqlite/database.inc
Increases the depth of transaction nesting.
1 method overrides DatabaseConnection::pushTransaction()
DatabaseConnection_sqlite::pushTransaction in includes/database/sqlite/database.inc
Increases the depth of transaction nesting.

File

includes/database/database.inc, line 1154

Class

DatabaseConnection
Base Database API class.

Code

public function pushTransaction($name) {
    if (!$this->supportsTransactions()) {
        return;
    }
    if (isset($this->transactionLayers[$name])) {
        throw new DatabaseTransactionNameNonUniqueException($name . " is already in use.");
    }
    // If we're already in a transaction then we want to create a savepoint
    // rather than try to create another transaction.
    if ($this->inTransaction()) {
        $this->query('SAVEPOINT ' . $name);
    }
    else {
        $this->connection
            ->beginTransaction();
    }
    $this->transactionLayers[$name] = $name;
}

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