Contents Index upload_new_row_insert table event upload_statistics connection event

MobiLink Synchronization Reference
  Synchronization Events

upload_old_row_insert table event


Function 

Conflict resolution scripts for statement-based uploads commonly require access to the old and new values of rows updated in the remote database. This event allows you to handle the new values of rows that were updated in the remote database during conflict resolution.

Parameters 
Item Parameter
1 column 1
2 column 2
... ...
Default action 

None.

Description 

The statement based upload_old_row_insert script performs direct insert of column values as specified in the upload_old_row_insert statement. You can have one upload_old_row_insert script for each table in the remote database.

For Java and .NET applications, this script must return valid SQL.

See also 

Handling conflicts

resolve_conflict table event

upload_new_row_insert table event

upload_update table event

SQL example 

This example is taken from the Contact sample and can be found in Samples\MobiLink\Contact\build_consol.sql. It handles updates made on the product table in the remote database. The script inserts the old value of the row into a global temporary table named product_conflict. The final column of the table identifies the row as an old row.

insert into DBA.product_conflict(
id, name, size, quantity, unit_price, row_type )
values( ?, ?, ?, ?, ?, 'O' )
Java example 

The following stored procedure call registers a Java method called uploadOldRowInsertTable as the script for the upload_old_row_insert table event when synchronizing the script version ver1. This syntax is for Adaptive Server Anywhere consolidated databases.

call ml_add_java_table_script(
  'ver1',
  'table1',
  'upload_old_row_insert',
  'ExamplePackage.ExampleClass.uploadNewRowInsertTable'
)

Following is the sample Java method uploadOldRowInsertTable. It dynamically generates an UPLOAD statement.

public string uploadOldRowInsertTable()
{  old" + getCols(_curTable) +
   "values" + getQM(_curTable)); }

Contents Index upload_new_row_insert table event upload_statistics connection event