Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 11.0.1 » SQL Remote » SQL Remote Replication Design » SQL Remote replication design and set up » Update conflicts


Custom conflict resolution using triggers

Custom conflict resolution can take several forms. For example, in some applications, resolution can:

Custom conflict resolution requires you to write RESOLVE UPDATE triggers.

Using the RESOLVE UPDATE conflict resolution trigger

RESOLVE UPDATE triggers fire before each row is updated. The syntax for a RESOLVE UPDATE trigger is as follows:

CREATE TRIGGER trigger-name
OF column-name ON table-name 
[ REFERENCING [ OLD AS old-val ]
   [ NEW AS new-val ]
     [ REMOTE AS remote-val ] ] 

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.

Using the CURRENT REMOTE USER special constant

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.

See also

Resolving date conflicts
Resolving inventory conflicts