When the MobiLink client initiates a synchronization, several synchronization events occur. At the occurrence of a synchronization event, MobiLink looks for a script to match the event. The script contains instructions detailing what you want done. If you have defined a script for the event and put it in a MobiLink system table, it is invoked.
Whenever an event occurs, the MobiLink server executes the associated script if you have created one. If no script exists, the next event in the sequence occurs.
When you use the Create Synchronization Model Wizard to create your MobiLink application, all the required MobiLink scripts are created for you. However, you can customize the default scripts, including creating new scripts.
The following are the typical upload scripts for tables. The first event, upload_insert, triggers the running of the upload_insert script, which inserts any changes in the emp_id and emp_name columns into the emp table. The upload_delete and upload_update scripts perform similar functions for delete and update actions on the emp table.
Event | Example script contents | ||
---|---|---|---|
upload_insert |
|
||
upload_delete |
|
||
upload_update |
|
The download script uses a cursor. The following is an example of a download_cursor script:
SELECT order_id, cust_id FROM ULOrder WHERE last_modified >= {ml s.last_table_download} AND emp_name = {ml r.emp_id} |
For more information about events and scripts, see:
You can write scripts using the native SQL dialect of your consolidated database, or using Java or .NET synchronization logic. Java and .NET synchronization logic allow you to write code, invoked by the MobiLink server, to connect to a database, manipulate variables, directly manipulate uploaded row operations, or add row operations to the download. There is a MobiLink server API for Java and a MobiLink server API for .NET that provide classes and methods to suit the needs of synchronization.
See Options for writing server-side synchronization logic.
For information about RDBMS-dependent scripting, see MobiLink consolidated databases.
SQL scripts are stored in MobiLink system tables in the consolidated database. For scripts written with the MobiLink server APIs, you store the fully qualified method name as the script. You can add scripts to a consolidated database in several ways:
When you use the Create Synchronization Model Wizard, scripts are stored in the MobiLink system tables when you deploy your project.
You can manually add scripts to the system tables by using stored procedures that are installed when you set up a consolidated database.
You can manually add scripts to the system tables using Sybase Central.
Discuss this page in DocCommentXchange. Send feedback about this page using email. |
Copyright © 2009, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.1 |