with-transaction ( quot -- )


Vocabulary
db

Inputs
quota quotation


Outputs
None

Word description
Calls the quotation inside a database transaction and commits the result to the database after the quotation finishes. If the quotation throws an error, the transaction is aborted. Nested calls run directly inside the enclosing transaction rather than starting a new one.

Notes
Direct continuation jumps out of the quotation bypass both commit and rollback. See Resource disposal and continuations. Top-level transactions are run through serialize-transaction, which holds the backend's db-write-lock if it has one.

Definition