public function DatabaseConnection_sqlite::rollback
public DatabaseConnection_sqlite::rollback($savepoint_name = 'drupal_transaction')
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.
Throws
DatabaseTransactionNoActiveException
Overrides DatabaseConnection::rollback
See also
DatabaseTransaction::rollback()
File
- includes/database/sqlite/database.inc, line 299
- Database interface code for SQLite embedded database engine.
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()) { PDO::rollBack(); } }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!database!sqlite!database.inc/function/DatabaseConnection_sqlite::rollback/7.x