groupor just for the user contained in the Message Agent connection string.
Usingthe CURRENT
REMOTEUSER special
constant
TheCURRENT REMOTE USER special constant holds the user ID of the
remoteuser sending the message. Thiscan be used in RESOLVE UPDATE
triggersthat place reports of conflicts into a table, to identify the user
producinga conflict.
Conflict resolution examples
Thissection describes some ways of using RESOLVE UPDATEtriggers to
handleconflicts.
Resolving date conflicts
Supposea table in a contact management system has a column holding the
mostrecent contact with each customer.
Onerepresentative talks with a customer on a Friday, but does not upload his
changesto the consolidated database until the next Monday. Meanwhile, a
secondrepresentative meets the customer on the Saturday, and updates the
changesthat evening.
Thereis no conflict when the Saturday UPDATE is replicated to the
consolidateddatabase, but when the Monday UPDATE arrives it finds the
rowalready changed.
Bydefault, the Monday UPDATE would proceed, leaving the column with
theincorrect information that the most recent contact occurred on Friday.
Updateconflicts on this column should be resolved by inserting the most
recentdate in the row.
Implementingthe
solution Thefollowing RESOLVE UPDATEtrigger chooses the most recent of the
twonew values and enters it in the database.
CREATE TRIGGER contact_date RESOLVE UPDATE
ON contact
REFERENCING OLD AS old_name
NEW AS new_name
FOR EACH ROW
BEGIN
IF new_name.contact_date <
old_name.contact_date THEN
SET new_name.contact_date
= old_name.contact_date
END IF
END
Ifthe value being updated is later than the value that would replace it, the
newvalue is reset to leave the entry unchanged.
124