User's Manual

Chapter 7. SQL Remote Design for Adaptive Server Anywhere
Resolving inventory conflicts
Consider a warehouse system for a manufacturer of sporting goods. There is
a table of product information, with a quantity column holding the number
of each product left in stock. An update to this column will typically deplete
the quantity in stock or, if a new shipment is brought in, add to it.
A sales representative at a remote database enters an order, depleting the
stock of small tank top tee shirts by five, from 28 to 23, and enters this in on
her database. Meanwhile, before this update is replicated to the consolidated
database, a new shipment of tee shirts comes in, and the warehouse enters
the shipment, adding 40 to the quantity column to make it 68.
28 > 6828 > 23
28 > 68
Updates
made at
remote
databases
The warehouse entry gets added to the database: the quantity column now
shows there are 68 small tank-top tee shirts in stock. When the update from
the sales representative arrives, it causes a conflict–Adaptive Server
Anywhere detects that the update is from 28 to 23, but that the current value
of the column is 68.
By default, the most recent UPDATE succeeds, and the inventory level is set
to the incorrect value of 23.
28 > 6828 > 23
68 > 23
Default
conflict
resolution:
wrong result
In this case the conflict should be resolved by summing the changes to the
125