Contents Index upload_fetch table event upload_new_row_insert table event

MobiLink Synchronization Reference
  Synchronization Events

upload_insert table event


Function 

Provides an event that the MobiLink synchronization server uses during processing of the upload stream to handle rows inserted into the remote database.

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

None.

Description 

The statement based upload_insert script performs direct inserts of column values.

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

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

See also 

upload_delete table event

upload_update table event

upload_fetch 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 inserts made on the Customer table in the remote database. The script inserts the values into a table named Customer in the consolidated database. The final column of the table identifies the Customer as active. The final column does not appear in the remote database.

INSERT INTO Customer( cust_id, name, rep_id, active )
VALUES ( ?, ?, ?, 1 )
Java example 

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

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

public string uploadInsertTable()
{  return("insert into" + _curTable + getCols(_curTable)
   + "values" + getQM(_curTable)); }
.NET example 

The following stored procedure call registers a .NET method called UploadInsert as the script for the upload_insert table event when synchronizing the script version ver1 and the table table1. This syntax is for Adaptive Server Anywhere consolidated databases.

call ml_add_dnet_table_script(
  'ver1',
  'table1',
  'upload_insert',
  'TestScripts.Test.UploadInsert'
)

Following is the C# signature for the call UploadInsert.

public string UploadInsert( string user )

Contents Index upload_fetch table event upload_new_row_insert table event