Name

COMMIT — Commit modifications made in the current transaction.Function

Syntax

      commit &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, commits 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"))
(commit)
=> NIL 
(in-transaction-p)
=> NIL
(select [*] :from [foo] :field-names nil)
=> ((1 "one"))
      

Side Effects

Changes made within the scope of the current transaction are committed 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
rollback
in-transaction-p
add-transaction-commit-hook
set-autocommit
with-transaction

Notes

None.