Contents Index end_upload_deletes table event example_upload_cursor table event

MobiLink Synchronization Reference
  Synchronization Events

end_upload_rows table event


Function 

Processes statements related to a specific table just after applying uploaded inserts and updates from the specified table in the remote database.

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 

Uploaded information can require inserting or updating rows in the consolidated database. This script is run immediately after applying the changes that result from modifications to the remote table named in the second parameter.

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

See also 

begin_upload_rows table event

SQL example 

You use this event to process rows deleted during the upload stream on an intermediate table. You can compare the rows in the base table with the rows in the intermediate table and decide what to do with the deleted row.

Call ml_add_table_script(
   'version1',
   'Leads',
   'end_uploads_deletes',
   'call EndUploadDeletesLeads()');
Create procedure EndUploadDeletesLeads ( )
Begin
  FOR names AS curs CURSOR FOR
  SELECT LeadID FROM Leads
    WHERE LeadID NOT IN (select LeadID from T_Leads);
  DO
   CALL decide_what_to_do( LeadID );
  END FOR;
end
Java example 

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

Following is the sample Java method endUploadRows. It calls a Java method that manipulates the database.

public String endUploadRows(    String user,
String table )
  throws java.sql.SQLException
{  processUploadedRows( _syncConn, table );
   return( null ); }
.NET example 

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

Following is the C# signature for the call EndUploadRows.

public void EndUploadRows(
  string user,
  string table )

Contents Index end_upload_deletes table event example_upload_cursor table event