Custom conflict resolution can take several forms. For example, in some applications, resolution can:
Compare the dates of the original transactions. See Resolving date conflicts.
Perform calculations on the results of two or more updates. See Resolving inventory conflicts.
Report the conflict into a table. See Using the CURRENT REMOTE USER special constant.
Custom conflict resolution requires you to write RESOLVE UPDATE triggers.
RESOLVE UPDATE triggers fire before each row is updated. The syntax for a RESOLVE UPDATE trigger is as follows:
CREATE TRIGGER trigger-name RESOLVE UPDATE OF column-name ON table-name [ REFERENCING [ OLD AS old-val ] [ NEW AS new-val ] [ REMOTE AS remote-val ] ] FOR EACH ROW BEGIN ... END
The REFERENCING clause allows access to the values in the row of the table to be updated (OLD), to the values the row is to
be updated to (NEW) and to the rows that should be present according to the VERIFY clause (REMOTE). Only columns present in
the VERIFY clause can be referenced in the REMOTE AS clause; other columns return a column not found
error.
CURRENT REMOTE USER is set by DBREMOTE when it executes the undocumented REMOTE USER statement. The value is NULL except for connections from DBREMOTE.
The CURRENT REMOTE USER can be used in RESOLVE UPDATE triggers that place reports of conflicts into a table, to identify the user producing a conflict.
Resolving date conflicts
Resolving inventory conflicts
Discuss this page in DocCommentXchange. Send feedback about this page using email. |
Copyright © 2009, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.1 |