

A transaction is a sequence of <sql statement>s that are handled by ADABAS as an atomic unit, in the sense that any modifications made to the database by the <sql statement> s are either all reflected in the state of the database, or else none of the database modifications are retained.
When a session is opened using the <connect statement>, this opens the first transaction. A <commit statement> or a <rollback statement> is used to conclude a transaction. When a transaction is successfully concluded using a <commit statement>, all database modifications are retained. When, on the other hand, a transaction is aborted using a <rollback statement>, or if it is aborted in another way, all database modifications performed within the given transaction are rolled back.
Each data definition and authorizing statement represents a transaction of its own, because it is preceded and concluded by a <commit statement>.
The <commit statement> and the <rollback statement> both implicitly open a new transaction.
Since ADABAS permits concurrent transactions on the same database objects, locks on rows, tables and the catalog are necessary to isolate individual transactions. Locks are either implicitly set by ADABAS in the course of processing an <sql statement> or explicitly set using the <lock statement>. These locks are assigned to the transaction that contains the <sql statement> or <lock statement>. ADABAS distinguishes between SHARE locks and EXCLUSIVE locks which either refer to rows or tables. In addition, there are special locks for the metadata of the catalog. These locks, however, are always set implicitly.
Once a SHARE lock is assigned to a transaction for a particular data object, other transactions can access the object but not modify it.
Once an EXCLUSIVE lock is assigned to a transaction for a particular data object, other transactions cannot modify this object. The object can only be accessed by transactions which do not use SHARE locks (see ISOLATION LEVEL 0).
The locks assigned to a transaction are released at the end of the transaction, making the respective database objects accessible again to other transactions.
The <savepoint statement> can be used to subdivide a transaction into additional atomic units, whose modifications can be undone using ROLLBACK TO <savepoint name>.
The following table gives a schematic overview on the possible parallel locks. EXCL means EXCLUSIVE.


