chickadee » sql-de-lite » with-immediate-transaction

with-transaction db thunk #!optional (type deferred)procedure
with-deferred-transaction db thunkprocedure
with-immediate-transaction db thunkprocedure
with-exclusive-transaction db thunkprocedure

Executes thunk within a BEGIN TRANSACTION block, and returns the value of thunk. The optional type may be one of the symbols deferred, immediate, or exclusive. You may also use the named convenience functions instead of the optional parameter.

The transaction is committed with (commit db) if thunk returns a true value. Escaping or re-entering the dynamic extent of thunk will not commit or rollback the in-progress transaction. However, if an exception occurs during thunk, or thunk returns #f, or the commit fails, the transaction will be rolled back with (rollback db). If this rollback fails, that is a critical error and you should likely abort.