Contents Index end_download_deletes table event end_publication connection event

MobiLink Synchronization Reference
  Synchronization Events

end_download_rows table event


Function 

Processes statements related to a specific table just after preparing a list of rows to be inserted or updated in 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. For example, you must use parameter 1 if you want to use parameter 2.

Item Parameter Description
1 last_download TIMESTAMP
2 ml_username VARCHAR(128)
3 table VARCHAR(128)
Default action 

None.

Description 

This script is executed immediately after preparing the stream of rows to be inserted or updated in the named table in the remote database.

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

The last_download timestamp is the value obtained from the consolidated database during the last successful synchronization immediately prior to the download phase. If the current user has never synchronized successfully, this value is set to 1900-01-01.

See also 

begin_download_rows table event

end_download connection event

end_download_deletes table event

begin_download_deletes table event

SQL example 

You may want to mark a row as successfully downloaded to the remote database in this event, using a WHERE clause on the UPDATE that matches the WHERE clause used for your download_cursor.

call ml_add_table_script(
   'version1',
   'Leads',
   'end_download_rows',
   'UPDATE Leads SET OnRemote = 1 WHERE LastModified > ?
      AND Owner = ? AND DownloadFlag=1');
Java example 

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

Following is the sample Java method endDownloadRows. 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 endDownloadRows(
  Timestamp ts,
  String user,
  String table )
{  java.lang.System.out.println( "Done downloading
   inserts and updates for table " + table );
   return( null ); }
.NET example 

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

Following is the C# signature for the call EndDownloadRows.

public void EndDownloadRows(
  DateTime timestamp,
  string user,
  string table )

Contents Index end_download_deletes table event end_publication connection event