Chapter 7. SQL Remote Design for AdaptiveSer verAnywhere
customconflict resolution, using a trigger to resolve conflicts in a way that
makessense for the data being changed.
Conflictresolution does not apply to primary key updates
UPDATEconflicts do
not
apply to primary key updates. You should not
update primary keys in a SQL Remote installation. Primary key conflicts
mustbe excluded from the installation by proper design.
Thissection describes how you can build conflict resolution into your
SQLRemote installation at the consolidated database.
How SQL Remote handles conflicts
Whena conflict is
detected SQLRemote replication messages include UPDATE statements as a set of
singlerow updates, each with a VERIFY clause that includes values prior to
updating.
AnUPDATE conflict is detected by the database server as a failure of the
VERIFYclause values to match the rows in the database.
Conflictsare detected and resolved by the Message Agent, but only at a
consolidateddatabase. Whenan UPDATE conflict is detected in a message
froma remote database, the Message Agent causes the database server to
taketwo actions:
1. Any conflict resolution (RESOLVE UPDATE)triggers are fired.
2. The UPDATE is applied.
UPDATEstatements are applied even if the VERIFY clause values do not
match,whether or not there is a RESOLVE UPDATEtrigger.
Conflictresolution can takeseveral forms. For example,
Insome applications, resolution could mean reporting the conflict into a
table.
Youmay wish to keep updates made at the consolidated database in
preferenceto those made at remote sites.
Conflictresolution can be more sophisticated, for example in resolving
inventorynumbers in the face of goods deliveries and orders.
Themethod of conflict resolution is different at an Adaptive Server
Enterpriseconsolidated database. Formore information, see “How SQL
Remotehandles conflicts” on page 166.
121