Contents Index upload_insert table event upload_old_row_insert table event

MobiLink Synchronization Reference
  Synchronization Events

upload_new_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 updated rows in the remote database during conflict resolution.

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

None.

Description 

You can use this event to assist in developing conflict resolution procedures for statement-based updates. The event parameters hold the values for the row in the remote database before the update was carried out. It is also used to insert INSERTed rows in statement-based, forced-conflict mode.

A typical action for this event is to hold the row in 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.

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

See also 

Handling conflicts

resolve_conflict table event

upload_old_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 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.

INSERT INTO DBA.product_conflict(
  id, name, size, quantity, unit_price, row_type )
VALUES( ?, ?, ?, ?, ?, 'N' )
Java example 

The following stored procedure call registers a Java method called uploadNewRowInsertTable as the script for the upload_new_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_new_row_insert',
  'ExamplePackage.ExampleClass.uploadNewRowInsertTable'
)

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

public string uploadNewRowInsertTable()
{  return("insert into" + _curTable + "_new" +
   getCols(_curTable) + "values" + getQM(_curTable)); }

Contents Index upload_insert table event upload_old_row_insert table event