Contents Index old_row_cursor cursor event (deprecated) report_error connection event

MobiLink Synchronization Reference
  Synchronization Events

prepare_for_download connection event


Function 

Processes any required operations between the upload and download transactions.

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 last_download TIMESTAMP
2 ml_username VARCHAR(128)
Default action 

None.

Description 

The MobiLink synchronization server executes this script as a separate transaction, between the upload transaction and the start of the download transaction.

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 

end_upload connection event

begin_download connection event

Java example 

The following stored procedure call registers a Java method called prepareForDownload as the script for the prepare_for_download event when synchronizing the script version ver1. This syntax is for Adaptive Server Anywhere consolidated databases.

call ml_add_java_connection_script(
   'ver1',
   'prepare_for_download',
   'ExamplePackage.ExampleClass.prepareForDownload' )

Following is the sample Java method prepareForDownload. It calls a Java method to modify some rows in the database.

public String prepareForDownload( Timestamp ts,
String user )
{  adjustUploadedRows( _syncConn, user );
   return( null ); }
.NET example 

The following stored procedure call registers a .NET method called PrepareForDownload as the script for the prepare_for_download connection event when synchronizing the script version ver1. This syntax is for Adaptive Server Anywhere consolidated databases.

call ml_add_dnet_connection_script( 'ver1',
  'prepare_for_download',
  'TestScripts.Test.PrepareForDownload'
)

Following is the C# signature for the call PrepareForDownload.

public void PrepareForDownload(
  DateTime timestamp,
  string user )

Contents Index old_row_cursor cursor event (deprecated) report_error connection event