Progress
Programming
Handbook
Making Transactions Smaller
Now imagine the reverse situation to the one in the last section. That is, in the event of a system crash or pressing STOP, you want to undo only the current order–line. Again, you use a DO block with the TRANSACTION option to tell Progress where to start transactions:
In
p-txn10.p
, Progress starts a transaction for each order and also for each order–line you enter. There are two outermost blocks that contain direct updates to the database:
- The DO TRANSACTION block is an outermost block that contains direct updates to the database (INSERT order). The DO TRANSACTION statement and its corresponding END statement make the insertion of the order record a transaction.
- The inner REPEAT block is an outermost block that contains direct updates to the database.
The outer REPEAT block is not the transaction block because it does not contain any direct updates to the database. Run
p-txn10.p
, entering the following data:
![]()
Press STOP while entering the second order–line. Progress undoes the current transaction block, which means that only the work done on the second order–line is undone. Order 1030 and the first order–line should be in the database. Run
p-check.p
to find out:
Note that any activity that occurs within a DO block that has no TRANSACTION or ON ERROR phrase in the block header is encompassed in an enclosing transaction or subtransaction and does not result in a transaction or subtransaction being started.
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |