MobiLink Synchronization Reference
Synchronization Events
Processes any statements just after the MobiLink synchronization server concludes preparation of the download data.
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) |
None.
The MobiLink synchronization server executes this script after all rows have been downloaded and, if expecting a download acknowledgement, confirmation of receipt has been received. Download information is processed in a single transaction. The execution of this script is the last non statistical action in this 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.
begin_download connection event
The following example shows one possible use of an end_download connection script.
DELETE FROM ULEmpCust ec WHERE ? IS NOT NULL AND ec.emp_id = ? AND action = ''D''
The following stored procedure call registers a Java method called endDownloadConnection as the script for the end_download connection event when synchronizing the script version ver1. This syntax is for Adaptive Server Anywhere consolidated databases.
call ml_add_java_connection_script( 'ver1', 'end_download', 'ExamplePackage.ExampleClass.endDownloadConnection' )
Following is the sample Java method endDownloadConnection. It uses the current MobiLink connection (saved earlier) to perform an update before the download ends.
public String endDownloadConnection( Timestamp ts, String user ) throws java.sql.SQLException { String del_sql = "DELETE FROM ULEmpCust ec " + "WHERE ec.emp_id = '" + user + "' " + "AND action = 'D' "; execUpdate( _syncConn, del_sql ); return( null ); }
The following stored procedure call registers a .NET method called EndDownload as the script for the end_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', 'end_download', 'TestScripts.Test.EndDownload' )
Following is the C# signature for the call EndDownload.
public void EndDownload( DateTime timestamp, string user )