Contents Index begin_synchronization connection event begin_upload connection event

MobiLink Synchronization Reference
  Synchronization Events

begin_synchronization table event


Function 

Processes statements related to a specific table at the time an application connects to the MobiLink synchronization server in preparation for the synchronization process.

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 after an application that is preparing to synchronize has formed a connection with the MobiLink synchronization server, and after the begin_synchronization connection-level event.

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

See also 

end_synchronization table event

begin_synchronization connection event

SQL example 

The begin_synchronization table event is used to set up the synchronization of a particular table. The following Adaptive Server Anywhere SQL procedure call registers a script that creates a temporary table for storing rows during synchronization.

call ml_add_table_script(
 'ver1',
 'sales_order',
 'begin_synchronization',
 'CREATE TABLE #sales_order
(
   id         integer NOT NULL default autoincrement,
   cust_id      integer NOT NULL,
   order_date      date NOT NULL,
   fin_code_id   char(2) NULL,
   region      char(7) NULL,
   sales_rep      integer NOT NULL,
   PRIMARY KEY (id),
)' )
Java example 

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

Following is the sample Java method beginSynchronizationTable. It adds the current table name to a list of table names contained in this instance.

public String beginSynchronizationTable(String user,
String table )
{  _tableList.add( table );
   return( null ); }
.NET example 

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

Following is the C# signature for the call BeginTableSync.

public void BeginTableSync( string user, string table )

Contents Index begin_synchronization connection event begin_upload connection event