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

SQL Anywhere 17 » MobiLink - Server Administration » MobiLink events » Synchronization events

upload_new_row_insert table event

Conflict resolution scripts for statement-based uploads commonly require access to the old and new values of rows uploaded from the remote database. This data script event allows you to handle the new, updated values of rows uploaded from the remote database.


In SQL scripts, you can specify event parameters by name or with a question mark. Using question marks has been deprecated. Use named parameters instead. You cannot mix names and question marks within a script. If you use question marks, the parameters must be in the order shown below and are optional only if no subsequent parameters are specified (for example, you must use parameter 1 if you are going to use parameter 2). If you use named parameters, you can specify any subset of the parameters in any order.

Parameter name for SQL scripts Description Order (deprecated for SQL)


VARCHAR(128). The MobiLink remote ID. You can only reference the remote ID if you are using named parameters.

Not applicable


VARCHAR(128). The MobiLink user name. This parameter is optional.

Optional (1 if referenced)

s.script_version VARCHAR(128). Optional IN parameter to specify that the MobiLink server passes the script version string used for the current synchronization to this parameter. Question marks cannot be used to specify this parameter.

Not applicable

r. column-1

Required. The first column value from the new (post-image) row, referenced by column name or column number.

1 (2 if username is referenced)

... ... ...

r. column-N

Required. The last column value from the new (post-image) row, referenced by column name or column number.

N (N+1 if username is referenced)

Default action



When a MobiLink client sends an updated row to the MobiLink server, it includes not only the new values (the post-image), but also a copy of the old row values (the pre-image). When the pre-image does not match the current values in the consolidated database, a conflict is detected.

After MobiLink detects a conflict, this event allows you to save post-image values to a table. You can use this event to assist in developing conflict resolution procedures for updates. The parameters for this event hold new row values from the remote database before the update is performed on the corresponding consolidated database table. This event is also used to insert rows in forced-conflict mode (forced-conflict mode has been deprecated.).

Note Conflict detection is usually performed much faster when done all at once in the upload_update script.

The script for this event is usually an insert statement that inserts the new row into a temporary table for use by a resolve_conflict script.

You can have one upload_new_row_insert script for each table in the remote database.

This script must be implemented in SQL. For Java or .NET processing of rows, use direct row handling.

SQL example

This example handles updates made on the product table in the remote database. The script inserts the new value of the row into a global temporary table named product_conflict. The final column of the table identifies the row as a new row.

CALL ml_add_table_script(
 'INSERT INTO DBA.product_conflict(
   row_type )
   {ml r.size}, 
   {ml r.quantity}, 
   {ml r.unit_price}, 
   ''New'' )' )