ALLBASE/SQL Reference Manual (36216-90216)

Chapter 5 191
Concurrency Control through Locks and Isolation Levels
Examples of Obtaining and Releasing Locks
Figure 5-9. Lock Requests 3: Share Locks Granted
Sample Transactions Using Isolation Levels
The following sections show typical situations in which different isolation levels affect the
behavior of your transactions when using the sample DBEnvironment PartsDBE.
Example of Repeatable Read
The following scenario illustrates the operation of the RR isolation level:
1. Two users each issue the following CONNECT statement (assume they are connecting
from a different directory than the one containing PartsDBE):
isql=> CONNECT TO 'PartsDBE.SomeGrp.SomeAcct';
2. User 1 then issues a query (transaction 1) as follows:
isql=> SELECT * FROM PurchDB.Vendors;
This implicitly issues a BEGIN WORK statement at the RR isolation level, and obtains a
share lock (S) on the Vendors table, because the scan is a sequential one, reading the
entire table. User 1 sees the query result in the ISQL browser, and exits the browser,
but does
not
issue a COMMIT WORK statement.
3. User 2 then issues the following statement (which starts transaction 2 at the RR
isolation level):
isql=> UPDATE PurchDB.Vendors