Contents Index end_download connection event end_download_deletes table event

MobiLink Synchronization Reference
  Synchronization Events

end_download table event


Function 

Processes statements related to a specific table just after the MobiLink synchronization server concludes preparing the stream of downloaded 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.

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 

The MobiLink synchronization server executes this script after all rows have been downloaded and confirmation of receipt has been received. The download information is prepared in a separate transaction. The execution of this script is the last table-specific, non-statistical action in this transaction.

You can have one end_download 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 table event

end_download connection event

SQL example 

The end_download table event is used to perform whatever steps you need performed after downloading a particular table. The following Adaptive Server Anywhere SQL script drops a temporary table created by a prepare_for_download script to hold download rows for the sales_summary table.

call ml_add_table_script(
 'MyCorp 1.0',
 'sales_summary',
 'end_download',
 'drop table #sales_summary_download' )
Java example 

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

Following is the sample Java method endDownloadTable. It resets the current table member variable.

public String endDownloadTable( Timestamp ts,
String user, String table )
{  _curTable = null;
   return( null ); }
.NET example 

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

Following is the C# signature for the call EndTableDownload.

public void EndTableDownload
  DateTime timestamp,
  string user,
  string table )

Contents Index end_download connection event end_download_deletes table event