Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 11.0.0 » MobiLink - Server Administration » MobiLink Events » Synchronization events

 

begin_upload connection event

Processes any statements just before the MobiLink 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.

Parameter name for SQL scripts

Description

Order

s.remote_id VARCHAR(128). The MobiLink remote ID. You can only reference the remote ID if you are using named parameters. Not applicable

s.username

VARCHAR (128). The MobiLink user name.

1

Default action

None.

Remarks

The MobiLink 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
SQL example

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

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 call to a MobiLink system procedure registers a Java method called beginUploadConnection as the script for the begin_upload connection event when synchronizing the script version ver1.

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. (Note that printing a message to the MobiLink output log 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 call to a MobiLink system procedure registers a .NET method called BeginUpload as the script for the begin_upload connection event when synchronizing the script version ver1.

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

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

public string BeginUpload( string curUser ) {
  user = curUser;
  return ( null );
}