MobiLink Synchronization User's Guide
Writing Synchronization Scripts
There are two scripts that can be used for processing each table during the download transaction. These are the download_cursor script, which carries out inserts and updates, and the download_delete_cursor script, which carries out deletes.
These scripts are either SELECT statements or calls to procedures that return result sets. The MobiLink synchronization server downloads the result set of the script to the remote database. The MobiLink client automatically inserts or updates rows based on the download_cursor script result set, and deletes rows based on the download_delete_cursor event.
For more information about using stored procedures, see Downloading a result set from a stored procedure call.
The MobiLink synchronization server downloads data in a single transaction. For a description of the download process, see Events during download.
Like the upload stream, the download stream starts and ends with connection events. Other events are table-level events.
By default, if no confirmation of the download is received from the client, the entire download transaction is rolled back in the consolidated database. You can change this behavior with the dbmlsync option SendDownloadACK (sa) extended option or UltraLite Send Download Acknowledgement synchronization parameter.
The begin_download and end_download scripts for each remote table hold logic that is independent of the individual rows being updated.
The download stream does not distinguish between inserts and updates. The script associated with the download_cursor event is a SELECT statement that defines the rows to be downloaded. The client detects whether the row exists or not and carries out the appropriate insert or update operation.
At the end of the download processing, the client automatically deletes rows if necessary to avoid referential integrity violations.
For more information, see Referential integrity and synchronization.
Writing download_cursor scripts
Writing download_delete_cursor scripts