Error message

You are browsing documentation for drupal 7.x, which is not supported anymore. Read the updated version of this page for drupal 11.x (the latest version).

function DatabaseConnection_sqlite::rollback

Rolls back the transaction entirely or to a named savepoint.

This method throws an exception if no transaction is active.

Parameters

$savepoint_name: The name of the savepoint. The default, 'drupal_transaction', will roll the entire transaction back.

Overrides DatabaseConnection::rollback

File

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

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.