Database Reference
In-Depth Information
239
FIGURE 7-8
The DBMS uses a locking scheme to apply the updates for Ryan and Elena to the database
(continued)
How long should the DBMS hold a lock? If the update involves changing field values in a single row in a
single table, such as changing a customer
s name and address, the lock no longer is necessary after this row
is updated. However, sometimes an update is more involved.
Consider the task of filling an order for Premiere Products. Ryan might think that filling an order involves
a single action. He simply indicates that an order currently in the database now needs to be filled. Alterna-
tively, Ryan might need to enter data about the order. In either case, Ryan still believes the process is a single
action. Behind the scenes, though, filling an order requires that the DBMS update several records in the data-
base. For example, suppose Ryan fills a new order for Brookings Direct that includes the sale of three washers
and two dryers; Richard Hull is the rep for Brookings Direct. To fill this order, the DBMS must update the
records in the database as follows:
'
￿
Add one record to the Orders table for the new order.
￿
Add one record to the OrderLine table for the sale of the three washers.
￿
Add one record to the OrderLine table for the sale of the two dryers.
￿
Change the washer record in the Part table to decrease the record
'
s number of units on hand by
three.
Search WWH ::




Custom Search