Contents Index begin_upload connection event begin_upload_deletes table event

MobiLink Synchronization Reference
  Synchronization Events

begin_upload table event


Function 

Processes statements related to a specific table just before the MobiLink synchronization server commences processing the stream of uploaded inserts, updates, and deletes.

Parameters 

In the following table, the description provides the SQL data type. If you are writing your script in Java or .NET, you should use the appropriate corresponding data type. See SQL-Java data types and SQL-.NET data types.

Event parameters are optional only if no subsequent parameters are specified. You must use parameter 1 if you want to use parameter 2.

Item Parameter Description
1 ml_username VARCHAR(128)
2 table VARCHAR(128)
Default action 

None.

Description 

The MobiLink synchronization server executes this event as the first step in the processing of uploaded information. Upload information is processed in a separate transaction. The execution of this event is the first table-specific action in this transaction.

You can have one begin_upload script for each table in the remote database. The script is only invoked when the table is actually synchronized.

See also 

end_upload table event

begin_upload connection event

SQL example 

When uploading rows from a remote you may want to place the changes in an intermediate table and manually process changes yourself. You can populate a global temporary table in this event.

call ml_add_table_script( 
  'version1', 
  'Leads',
  'begin_upload', 
  'insert into T_Leads SELECT *
FROM Leads WHERE Owner = @EmployeeID')
Java example 

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

Following is the sample Java method beginUploadTable. This example takes no action. MobiLink interprets NULL as no script.

public String beginUploadTable( String user,
String table )
{  return( null ); }
.NET example 

The following stored procedure call registers a .NET method called BeginTableUpload as the script for the begin_upload 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', 'begin_upload',
  'TestScripts.Test.BeginTableUpload'
)

Following is the C# signature for the call BeginTableUpload.

public void BeginTableUpload(
  string user,
  string table )

Contents Index begin_upload connection event begin_upload_deletes table event