inventory column to produce the final result, so that a final value of 63 is placed into the database.

Conflict

resolution

trigger:

correct68 > 63 result

28 > 2328 > 68

Implementing the

A suitable RESOLVE UPDATE trigger for this situation would add the

solution

increments from the two updates. For example,

 

CREATE TRIGGER resolve_quantity

 

RESOLVE UPDATE OF quantity

 

ON "DBA".product

 

REFERENCING OLD AS old_name

 

NEW AS new_name

 

REMOTE AS remote_name

 

FOR EACH ROW

 

BEGIN

SET new_name.quantity = new_name.quantity + old_name.quantity

- remote_name.quantity

END

This trigger adds the difference between the old value in the consolidated database (68) and the old value in the remote database when the original UPDATE was executed (28) to the new value being sent, before the UPDATE is implemented. Thus, new_val.quantity becomes 63 (= 23 + 68 - 28), and this value is entered into the quantity column.

Consistency is maintained at the remote database as follows:

1. The original remote UPDATE changed the value from 28 to 23.

2. The warehouse’s entry is replicated to the remote database, but fails as the old value is not what was expected.

3. The changes made by the RESOLVE UPDATE trigger are replicated to the remote database.

Reporting conflicts

In some cases, you may not want to alter the default way in which

126

Page 144
Image 144
Sybase DC38133-01-0902-01 manual Increments from the two updates. For example, Reporting conflicts