Chapter 7. SQL Remote Design for Adaptive Server Anywhere

UPDATE table-list

SET column-name = expression, . . .

[ VERIFY (column-name, . . . ) VALUES ( expression, . . . ) ] [ WHERE search-condition]

The VERIFY clause can be used only if table-listconsists of a single table. It compares the values of specified columns to a set of expected values, which are the values that were present in the publisher database when the UPDATE statement was applied there. When the VERIFY clause is specified, only one table can be updated at a time.

The VERIFY clause is useful only for single-row updates. However, multi-row update statements entered at a database are replicated as a set of single-row updates by the Message Agent, so this imposes no constraints on client applications.

Conflict resolution trigger The syntax for a RESOLVE UPDATE trigger is as follows:

syntax

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

RESOLVE UPDATE triggers fire before each row is updated. 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 produce a “column not found” error.

Using the VERIFY_ALL_ The database option VERIFY_ALL_COLUMNS is OFF by default. If it is

COLUMNS option set to ON, all columns are verified on replicated updates, and a RESOLVE UPDATE trigger is fired whenever any column is different. If it is set to OFF, only those columns that are updated are checked.

Setting this option to ON makes messages bigger, because more information is sent for each UPDATE.

If this option is set at the consolidated database before remote databases are extracted, it will be set at the remote databases also.

You can set the VERIFY_ALL_COLUMNS option either for the PUBLIC

123

Page 141
Image 141
Sybase DC38133-01-0902-01 manual Create Trigger trigger-name, Referencing OLD AS oldval