Contents Index modify_last_download_timestamp connection event modify_user connection event

MobiLink Synchronization Reference
  Synchronization Events

modify_next_last_download_timestamp connection event


Function 

The script can be used to modify the last_download timestamp for the next synchronization.

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 download_timestamp TIMESTAMP. This is an INOUT parameter.
2 last_download_timestamp TIMESTAMP
3 ml_username VARCHAR(128)
Default action 

None.

Description 

Use this script when you want to modify the last download timestamp for the next synchronization. If this script is defined, the MobiLink synchronization server calls this script and sends the next last download timestamp down to the remote, which will send it as part of the next synchronization.

SQL scripts for the modify_next_last_download_timestamp event must be implemented as stored procedures. The MobiLink synchronization server passes in the download_timestamp as the first parameter to the stored procedure, and replaces the timestamp by the first value passed out by the stored procedure.

You can use this script to modify the download timestamp that the MobiLink synchronization server sends to the MobiLink client. If the client is dbmlsync, the timestamp is stored in the SYSSYNC system table.

This script is executed in the download transaction, after downloading user tables.

SQL example 

The following example shows one application of this script. First, create a procedure for your Adaptive Server Anywhere consolidated database:

CREATE PROCEDURE ModifyNextDownloadTimestamp(
  inout download_timestamp TIMESTAMP ,
  in last_download TIMESTAMP ,
  in user_name VARCHAR(128) )
  BEGIN
    SELECT dateadd(hour, -1, download_timestamp )
    INTO download_timestamp
END

Second, install the script into your Adaptive Server Anywhere consolidated database:

call ml_add_connection_script(
  'modify_ts_test',
  'modify_next_last_download_timestamp',
  'call  ModifyNextDownloadTimestamp ( ?, ?, ? )' )
Java example 

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

call ml_add_java_connection_script(
   'ver1',
   'modify_next_last_download_timestamp',
   'ExamplePackage.ExampleClass.modifyNextDownloadTimestamp' )

Following is the sample Java method modifyNextDownloadTimestamp. It sets the download timestamp back an hour.

public String modifyNextDownloadTimestamp(
  Timestamp download_timestamp,
  Timestamp last_download,
  String user_name )
{  download_timestamp.setHours(
   download_timestamp.getHours() -1 );
   return( null ); }

Contents Index modify_last_download_timestamp connection event modify_user connection event