public function DatabaseTransaction::rollback

public DatabaseTransaction::rollback()

Rolls back the current transaction.

This is just a wrapper method to rollback whatever transaction stack we are currently in, which is managed by the connection object itself. Note that logging (preferable with watchdog_exception()) needs to happen after a transaction has been rolled back or the log messages will be rolled back too.

See also

DatabaseConnection::rollback()

watchdog_exception()

File

includes/database/database.inc, line 1964
Core systems for the database layer.

Class

DatabaseTransaction
A wrapper class for creating and managing database transactions.

Code

public function rollback() {
  $this->rolledBack = TRUE;
  $this->connection->rollback($this->name);
}

© 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!database.inc/function/DatabaseTransaction::rollback/7.x