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

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


end_upload table event

Processes statements related to a specific table just after the MobiLink server concludes processing the stream of uploaded inserts, updates, and deletions.


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.

In SQL scripts, you can specify event parameters by name or with a question mark, but you cannot mix names and question marks within a script. If you use question marks, the parameters must be in the order shown below and are optional only if no subsequent parameters are specified (for example, you must use parameter 1 if you want to use parameter 2). If you use named parameters, you can specify any subset of the parameters in any 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


VARCHAR(128). The MobiLink user name.



VARCHAR(128). The table name.


Default action



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

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

See also
SQL example

The following call to a MobiLink system procedure assigns the end_upload event to a stored procedure called ULCustomerIDPool_maintain.

CALL ml_add_table_script(
   'CALL ULCustomerIDPool_maintain( username );' );

The following SQL statements create the ULCustomerIDPool_maintain stored procedure.

  SyncUserID IN integer )
  pool_count INTEGER;
  pool_max   INTEGER;
  -- Determine how many ids to add to the pool
    INTO pool_count
    FROM ULCustomerIDPool
    WHERE pool_emp_id = SyncUserID;
  -- Determine the current Customer id max
  SELECT MAX(pool_cust_id)
    INTO pool_max
    FROM ULCustomerIDPool;
  -- Top up the pool with new ids
  WHILE pool_count < 20 LOOP
    pool_max := pool_max + 1;
      INSERT INTO ULCustomerIDPool(
          pool_cust_id, pool_emp_id )
            VALUES ( pool_max, SyncUserID );
      pool_count := pool_count + 1;
Java example

The following call to a MobiLink system procedure registers a Java method called endUploadTable as the script for the end_upload table event when synchronizing the script version ver1.

CALL ml_add_java_table_script(
   'ExamplePackage.ExampleClass.endUploadTable' )

The following is the sample Java method endUploadTable. It generates a delete for a table with a name related to the passing-in table name. This syntax is for SQL Anywhere consolidated databases.

public String endUploadTable(
  String user,
  String table ) {
  return( "DELETE from '" + table + "_temp'" ); 
.NET example

The following call to a MobiLink system procedure registers a .NET method called EndUpload as the script for the end_upload table event when synchronizing the script version ver1 and the table table1.

CALL ml_add_dnet_table_script(

The following .NET example moves rows inserted into a temporary table into the table passed into the script.

public string EndUpload( string user, string table ) {
  DBCommand stmt = curConn.CreateCommand();
  // Move the uploaded rows to the destination table.
  stmt.CommandText = "INSERT INTO "
    + table
    + " SELECT * FROM dnet_ul_temp";
  return ( null );