Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 11.0.0 » MobiLink - Server Administration » MobiLink Events » Writing synchronization scripts

 

Script versions

Scripts are organized into groups called script versions. By specifying a particular version, MobiLink clients can select which set of synchronization scripts are used to process the upload and prepare the download.

For information about how to add a script version to the consolidated database, see Adding a script version.

Application of script versions

Script versions allow you to organize your scripts into sets, which are run under different circumstances. This ability provides flexibility and is especially useful in the following circumstances:

  • Customizing applications   Using a different set of scripts to process information from different types of remote users. For example, you could write a different set of scripts for use when managers synchronize their databases than would be used for other people in the organization. Although you could achieve the same functionality with one set of scripts, these scripts would be more complicated.

  • Upgrading applications   When you want to upgrade a database application, new scripts may be needed because the new version of your application may handle data differently. New scripts are almost always necessary when the remote database changes. It is usually impossible to upgrade all users simultaneously. MobiLink clients can request that a new set of scripts be used during synchronization. Since both old and new scripts can coexist on the server, all users can synchronize no matter which version of your application they are using.

  • Maintaining multiple applications   A single MobiLink server may need to synchronize two entirely different applications. For example, some employees may use a sales application, whereas others require an application designed for inventory control. When two applications require different sets of data, you can create two versions of the synchronization scripts, one version for each application.

  • Setting properties for the script version   You can set properties for your script version that can be referenced from classes in .NET or Java synchronization logic. See ml_add_property system procedure.

Assigning version names

A script version name is a string. You specify this name when you add a script to the consolidated database. For example, if you add your scripts with the ml_add_connection_script and the ml_add_table_script stored procedures, the script version name is the first parameter. Alternatively, if you add your scripts using Sybase Central, you are prompted for the version name.

You cannot use the following names for script versions: ml_sis_1 or ml_qa_1. These names are used internally by MobiLink.

Caution

It is strongly recommended that your script version names do not start with ml_. Script versions starting with ml_ are reserved for internal use.

Specifying a version for a synchronization

If no script version is specified at the remote site when synchronization is initiated, the synchronization fails.

ml_global script version

You can create a script version called ml_global that is used differently from other script versions. If you create a script version called ml_global, you define it once and then the connection scripts associated with are automatically used in all synchronizations. You never explicitly specify ml_global as a script version.

If you define a script in the ml_global script version and then you define a script for the same event in the script version that you specify for the synchronization, the specified script version is used. Scripts in the ml_global script version are only used if they are not defined in the primary script version that is being synchronized.

The ml_global script version can only contain connection-level scripts. It is not required, and may not be useful if you are using only one script version.


Adding a script version