Progress
Programming
Handbook
Making a Transaction Larger
In the last procedure, you EXCLUSIVE–LOCKed one order record at a time: you got an EXCLUSIVE–LOCK when you INSERTed the record at the start of the outer REPEAT block. At the end of the outer REPEAT block, Progress released that EXCLUSIVE–LOCK, making the record available to other users.
Suppose you want to EXCLUSIVE–LOCK all the order records you create, retaining those locks until you finish creating order records. You can do this by simply making the transaction larger, as shown in Figure 13–6.
p-txn4.pFigure 13–6: Making Transactions Larger
![]()
The TRANSACTION option on the DO block overrides the default transaction placement. Even though an outermost REPEAT, FOR EACH, or procedure block that contains direct database updates normally is made the transaction block, the TRANSACTION option overrides that default.
Now, you still get an EXCLUSIVE–LOCK when you INSERT an order record at the start of the outer REPEAT block. But remember that Progress releases EXCLUSIVE–LOCKs at the end of the transaction. When the REPEAT block ends, the transaction is not over, so Progress retains the EXCLUSIVE–LOCK. When you INSERT the next record, you get another EXCLUSIVE–LOCK on that record.
You can have many order and order–line records EXCLUSIVE–LOCKed, preventing other users from accessing those records. You can also have many item records SHARE–LOCKed, preventing other users from updating those records.
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |