Progress
Programming
Handbook


Changing the Size of a Transaction

Previous chapters showed how the size of a transaction affects how much work is undone or recovered in the event of a system failure or an error (see "Handling User Input," and "Transactions" for information). Now you know that transactions and record locks are closely related. Figure 13–5 shows how changing the size of a transaction affects record locks.

p-txn3a.p

Figure 13–5: Transaction Size and Locks

In this procedure, the outer REPEAT block is the transaction block. The INSERT statement creates an order record and gets an EXCLUSIVE–LOCK on that record. Progress holds that lock until the end of the transaction block (the outer REPEAT block).

The UPDATE statement in the inner REPEAT block lets you update order–line records. While you update order–line records, you still have an EXCLUSIVE–LOCK on the order record you created at the start of the REPEAT block. Because of that lock, no other user can access that order record until you finish updating order–line records and release your EXCLUSIVE lock (and, in this case, the record as well) at the end of the outer REPEAT block.

It is also important to note that just prior to the end of each transaction, all of the order–line records created are EXCLUSIVE–LOCKed and all of the item records found are SHARE–LOCKed.


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095