Try OpenEdge Now
skip to main content
Developing WebSpeed Applications
Controlling Database Transactions : What is a database transaction? : All-or-nothing processing
 

All-or-nothing processing

Suppose a customer calls to change an order for four sweat bands to nine sweat bands. This means you must make two changes to your database:
*First, you must look at the customer's order and change the quantity field in the appropriate order-line record.
*Second, you must change the value of the allocated field in the record for that item in the item table.
What if you changed the quantity field in the order-line record and are in the midst of changing the allocated field in the item record, when the machine goes down? You want to restore the records to their original state. That is, you want to be sure that WebSpeed changes both records or changes neither.
The following figure shows this scenario for a database similar to Sports2000 (same tables, different data).
Figure 17. Database transaction involving two tables