MobiLink provides many events that you can exploit, but it is not mandatory to provide scripts for each event. In a simple synchronization model, you may need only a few scripts.
Downloading all the rows from the table to each remote database synchronizes the ULProduct table in the CustDB sample application. In this case, no additions are permitted at the remote databases. You can implement this simple form of synchronization with two scripts; in this case only two events have a script associated with them.
The MobiLink event that controls the rows to be downloaded during each synchronization is named the download_cursor event. Cursor scripts must contain SELECT statements. The MobiLink server uses these queries to define a cursor. For a download_cursor script, the cursor selects the rows to download to one particular table in the remote database.
In the CustDB sample application, there is a single download_cursor script for the ULProduct table in the sample application, which consists of the following query:
SELECT prod_id, price, prod_name FROM ULProduct |
This query generates a result set. The rows that make up this result set are downloaded to the client. In this case, all the rows of the table are downloaded.
The MobiLink server knows to send the rows to the ULProduct application table because this script is associated with both the download_cursor event and ULProduct table by the way it is stored in the consolidated database. Sybase Central allows you to make these associations.
The second required event is the download_delete_cursor, which must have a script defined, along with the download_cursor, for each table being downloaded. This simple example does not use download deletes so the script is defined as --{ml_ignore}.
In this example, the query selects data from a consolidated table also named ULProduct. The names need not match. You could, instead, download data to the ULProduct application table from any table, or any combination of tables, in the consolidated database by rewriting the query.
You can write more complicated synchronization scripts. For example, you could write a script that downloads only recently modified rows, or one that provides different information to each remote database.
Discuss this page in DocCommentXchange.
|
Copyright © 2012, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.1 |