Contents Index begin_synchronization table event begin_upload table event

MobiLink Synchronization Reference
  Synchronization Events

begin_upload connection event


Function 

Processes any statements 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.

Item Parameter Description
1 ml_username 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 single transaction. The execution of this event is the first action in this transaction.

See also 

end_upload connection event

begin_upload table event

SQL example 

The begin_upload connection event is used to perform whatever steps you need performed prior to uploading rows. The following Adaptive Server Anywhere SQL script creates a temporary table for storing old and new row values for conflict processing of the sales_order table.

call ml_add_connection_script(
 'version1',
 'begin_upload',
 'CREATE TABLE #sales_order_conflicts
(
   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,
   new_value      char(1) NOT NULL,
   PRIMARY KEY (id),
)' )
Java example 

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

call ml_add_java_connection_script( 'ver1', 'begin_upload',
'ExamplePackage.ExampleClass. beginUploadConnection ' )

Following is the sample Java method beginUploadConnection. It prints a message to the MobiLink output log. (This might be useful at development time but would slow down a production server.)

public String beginUploadConnection( String user )
{  java.lang.System.out.println(
     "Starting upload for user: " + user );
   return( null ); }
.NET example 

The following stored procedure call registers a .NET method called BeginUpload as the script for the begin_upload connection event when synchronizing the script version ver1. This syntax is for Adaptive Server Anywhere consolidated databases.

call ml_add_dnet_connection_script(
  'ver1',
  'begin_upload',
  'TestScripts.Test.BeginUpload'
)

Following is the C# signature for the call BeginUpload.

public void BeginUpload( string user )

The following C# example saves the current user name for use in a later event.

public void BeginUpload( string curUser )
{
    user = curUser;
}

Contents Index begin_synchronization table event begin_upload table event