Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 17 » MobiLink - Server Administration » MobiLink events » Synchronization events

end_download connection event

Processes any statements just after the MobiLink server concludes preparation of the download data.

Parameters

In the following table, the description provides the SQL data type. If you are writing your script in Java or .NET, use the appropriate corresponding data type.

In SQL scripts, you can specify event parameters by name or with a question mark. Using question marks has been deprecated. Use named parameters instead. You cannot mix names and question marks within a script. If you use question marks, the parameters must be in the order shown below and are optional only if no subsequent parameters are specified (for example, you must use parameter 1 if you are going to use parameter 2). If you use named parameters, you can specify any subset of the parameters in any order.

Parameter name for SQL scripts Description Order (deprecated for SQL)

s.last_download

TIMESTAMP. The oldest download time of any synchronized table.

1

s.remote_id VARCHAR(128). The MobiLink remote ID. You can only reference the remote ID if you are using named parameters. Not applicable

s.username

VARCHAR(128). The MobiLink user name.

2

s.script_version VARCHAR(128). Optional IN parameter to specify that the MobiLink server passes the script version string used for the current synchronization to this parameter. Question marks cannot be used to specify this parameter. Not applicable
Default action

None.

Remarks

The MobiLink server executes this script after all download rows have been fetched from the consolidated database. The execution of this script is the last non-statistical action in the download.

SQL example

The following example shows one possible use of an end_download connection script. This script deletes rows from a temporary table used to help generate the download.

CALL ml_add_connection_script(
 'ver1',
 'end_download',
 'DELETE FROM TempDownloadTable where user = {ml s.username}')
Java example

The following call to a MobiLink system procedure registers a Java method called endDownloadConnection as the script for the end_download connection event when synchronizing the script version ver1.

CALL ml_add_java_connection_script(
  'ver1',
  'end_download',
  'ExamplePackage.ExampleClass.endDownloadConnection' )

The following is the sample Java method endDownloadConnection. It prints a message to the MobiLink message log. (Printing a message to the MobiLink message log might be useful at development time but would slow down a production server.)

package ExamplePackage;
import java.sql.*;
public class ExampleClass {
    String _curUser = null;
public void endDownloadConnection(
  Timestamp ts,
  String user )
{
  java.lang.System.out.println( "Ending download for user: " + user );
  }}
.NET example

The following call to a MobiLink system procedure registers a .NET method called EndDownload as the script for the end_download connection event when synchronizing the script version ver1.

CALL ml_add_dnet_connection_script(
 'ver1',
 'end_download',
 'TestScripts.Test.EndDownload' )

The following is the sample .NET method EndDownload. It prints a message to the MobiLink message log. (Printing a message to the MobiLink message log might be useful at development time but would slow down a production server.)

public void EndDownload(
  DateTime timestamp,
  string user ) {
  System.Console.WriteLine( "Ending download for user: " + user );
  }