Name

START-TRANSACTION — Open a transaction block.Function

Syntax

      start-transaction &key database => NIL

Arguments and Values

database

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

Description

Starts a transaction block on database which defaults to *default-database* and which continues until rollback or commit are called.

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

Autocommit mode is disabled and if database is currently within the scope of a transaction, all commit and rollback hooks are removed and the transaction level associated with database is modified.

Affected by

None.

Exceptional Situations

Signals an error of type sql-database-error if database is not a database object.

See Also

commit
rollback
in-transaction-p
set-autocommit
with-transaction

Notes

start-transaction is a CLSQL extension.