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

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

 

Scripts and the synchronization process

Each script corresponds to a particular event in the synchronization process. You write a script only when some action must occur. All unnecessary events can be left undefined.

The two principal parts of the process are the processing of uploaded information and the preparation of rows for downloading.

The MobiLink server reads and prepares each script once, when it is first needed. The script is then executed whenever the event is invoked.

The sequence of events

For information about the full sequence of MobiLink events, see Overview of MobiLink events.

For the details of upload processing, see Writing scripts to upload rows.

For the details of download processing, see Writing scripts to download rows.

Notes
  • MobiLink technology allows multiple clients to synchronize concurrently. In this case, each client uses a separate connection to the consolidated database.

  • The begin_connection and end_connection events are independent of any one synchronization as one connection can handle many synchronization requests. These scripts have no parameters. These are examples of connection-level scripts.

  • Some events are invoked only once for each synchronization and have a single parameter. This parameter is the user name, which uniquely identifies the MobiLink client that is synchronizing. These are also examples of connection-level scripts.

  • Some events are invoked once for each table being synchronized. Scripts associated with these events are called table-level scripts. They provide two parameters. The first is the user name supplied in the call to the synchronization function, and the second is the name of the table in the remote database being synchronized.

    While each table can have its own table scripts, you can also write table-level scripts that are shared by several tables.

  • Some events, such as begin_synchronization, occur at both the connection level and the table level. You can supply both connection and table scripts for these events.

  • The COMMIT statements illustrate how the synchronization process is broken up into distinct transactions.

  • Errors are a separate event that can occur at any point within the synchronization process. Errors are handled using the following script.

    handle_error( error_code, error_message, user_name, table_name )

For reference material, including details about each script and its parameters, see Synchronization events.