Contents Index end_synchronization table event end_upload table event

MobiLink Synchronization Reference
  Synchronization Events

end_upload connection event


Function 

Processes any statements just after the MobiLink synchronization server concludes processing 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 script as the last step in the processing of uploaded information. Upload information is processed in a single transaction. The execution of this script is the last action in this transaction before statistical scripts.

See also 

begin_upload connection event

end_upload table event

SQL example 

The following statements define a stored procedure and an end_upload script suited to the CustDB sample application from an Oracle installation.

CREATE OR REPLACE PROCEDURE ULCustomerIDPool_maintain(
  SyncUserID IN integer )
AS
  pool_count INTEGER;
  pool_max   INTEGER;
BEGIN
  -- Determine how many ids to add to the pool
  
SELECT COUNT(*)
    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;
  END LOOP;
END;
 ml_add_table_script(
   'custdb',
   'ULCustomerIDPool',
   'end_upload', -
ULCustomerIDPool_maintain( ? );)
Java example 

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

Following is the sample Java method endUploadConnection. It calls a method to perform operations on the database.

public String endUploadConnection( String user )
{  // clean up new and old tables
   Iterator    two_iter = _tables_with_ops.iterator();
   while( two_iter.hasNext() )
   {  TableInfo cur_table = (TableInfo)two_iter.next();
      dumpTableOps( _sync_conn, cur_table ); }
    _tables_with_ops.clear(); }
.NET example 

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

Following is the C# signature for the call EndUpload.

public void EndUpload( string user )

Contents Index end_synchronization table event end_upload table event