Name

ROLLBACK — Roll back modifications made in the current transaction.Function

Syntax

      rollback &key database => NIL

Arguments and Values

database

A database object. This will default to the value of *default-database*.

Description

If database, which defaults to *default-database*, is currently within the scope of a transaction, rolls back changes made since the transaction began.

Examples

(in-transaction-p)
=> NIL
(select [*] :from [foo] :field-names nil)
=> NIL
(start-transaction)
=> NIL 
(in-transaction-p)
=> T
(insert-records :into [foo] :av-pairs '(([bar] 1) ([baz] "one")))
=> 
(select [*] :from [foo] :field-names nil)
=> ((1 "one"))
(rollback)
=> NIL 
(in-transaction-p)
=> NIL
(select [*] :from [foo] :field-names nil)
=> NIL
      

Side Effects

Changes made within the scope of the current transaction are reverted in the underlying database and the transaction level of database is reset.

Affected by

The transaction level of database which indicates whether a transaction has been initiated by a call to start-transaction since the last call to rollback or commit.

Exceptional Situations

Signals an error of type sql-database-error if database is not a database object. A warning of type sql-warning is signalled if there is no transaction in progress.

See Also

start-transaction
commit
in-transaction-p
add-transaction-rollback-hook
set-autocommit
with-transaction

Notes

None.