Collection Contents Previous Next PDF

MobiLink Administration Guide

Synchronization Techniques

Handling conflicts

Detecting conflicts


When a MobiLink client sends an updated row to the MobiLink synchronization server, it includes not only the new values (the post-image), but also a copy of the old row values (the pre-image). When the pre-image does not match the current values in the consolidated database, a conflict is detected.

There are two ways to detect conflicts:

If you define both of these scripts for the same table, only the upload_fetch script is used.

The MobiLink synchronization server detects conflicts only if an upload_fetch or appropriate upload_update script is applied. If an upload_fetch script is supplied, the MobiLink synchronization server compares the pre-image of an update to the values of the row returned by the upload_fetch script with the same primary key values. If values in the pre-image do not match the current consolidated values, the MobiLink synchronization server detects a conflict.

upload_fetch 

The upload_fetch script typically selects a single row of data from a consolidated database table corresponding to the row being updated. A typical upload_fetch script has the following syntax:

SELECT col1col2, ...
FROM table-name
WHERE pk1 = ? AND pk2 = ? ...

For more information, see upload_fetch table event.

upload_update 

The upload_update script provides a parameter for each column in the row.

The parameters for an upload_update event are arranged so that statements with the following syntax update rows correctly:

UPDATE table-name
SET col1 = ?, col2 = ?, ...
WHERE pk1 = ? AND pk2 = ? ...

In this statement, col1, col2 and so on are the non-primary key columns, while pk1, pk2 and so on are primary key columns.

For a conflict to be detected, the syntax must be as follows:

UPDATE table-name
SET col1 = ?, col2 = ?, ...
WHERE pk1 = ? AND pk2 = ? ...
AND col1 = ? AND col2 = ? ...

The WHERE clause compares old values uploaded from the remote to current values in the consolidated database. If the values do not match, the update is ignored, thus preserving the values already on the consolidated database.

For more information, see upload_update table event.


Collection Contents Previous Next PDF