A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.lispworks.com/documentation/lw71/LW/html/lw-1269.htm below:

with-transaction

Description

The macro with-transaction executes body within a transaction for database (which defaults to *default-database*). The transaction is committed if the body finishes successfully (without aborting or throwing), otherwise the database is rolled back.

with-transaction returns the value or multiple values returned from body.

Example

The following example shows how to use with-transaction to insert a new record, updates the department number of employees from 40 to 50, and removes employees whose salary is higher than 300,000. If an error occurs anywhere in the body and an abort or throw is executed, none of the updates are committed.

(with-transaction
 (insert-record :into [emp]
              :attributes '(x y z)
               :values '(a b c))
 (update-records [emp]
    :attributes [dept]
    :values 50
    :where [= [dept] 40])
 (delete-records :from [emp]
    :where [> [salary] 300000]))

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4