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

SQL Anywhere 11.0.1 (Français) » MobiLink - Server Administration » MobiLink Events » Synchronization events

 

end_download_deletes table event

Processes statements related to a specific table just after preparing a list of rows to be deleted from the specified table in the remote database.

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.

In SQL scripts, you can specify event parameters by name or with a question mark, but 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 want 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

s.last_table_download

TIMESTAMP. The last download time for the 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.table

VARCHAR(128). The table name.

3

Default action

None.

Remarks

This script is executed immediately after preparing a list of rows to be deleted from the named table in the remote database.

You can have one end_download_deletes script for each table in the remote database.

See also
SQL example

You may want to mark a row as deleted on the remote database. The following script updates a column in the consolidated database called OnRemote.

Note

The WHERE clause on the UPDATE matches the WHERE clause used for your download_delete_cursor event script.

CALL ml_add_table_script(
 'version1',
 'Leads',
 'end_download_deletes',
 'UPDATE Leads SET OnRemote = 0
  WHERE LastModified >= {ml s.last_table_download}
   AND Owner = {ml s.username} AND DeleteFlag=1');
Java example

The following call to a MobiLink system procedure registers a Java method called endDownloadDeletes as the script for the end_download_deletes table event when synchronizing the script version ver1.

CALL ml_add_java_table_script(
  'ver1',
  'table1',
  'end_download_deletes',
  'ExamplePackage.ExampleClass.endDownloadDeletes' )

You may want to mark a row as deleted on the remote database. The following is the sample Java method endDownloadDeletes. It updates a column in the consolidated database called OnRemote to indicate the record no longer resides on the remote database.

Note

The WHERE clause on the UPDATE matches the WHERE clause used for your download_delete_cursor event script.

public String endDownloadDeletes(
  Timestamp ts,
  String user,
  String table ) {
  return( "UPDATE Leads SET OnRemote = 0 
     WHERE LastModified >= {ml s.last_table_download} 
     AND Owner = {ml s.username} AND DeleteFlag=1" ); 
}
.NET example

The following call to a MobiLink system procedure registers a .NET method called EndDownloadDeletes as the script for the end_download_deletes table event when synchronizing the script version ver1 and the table table1.

CALL ml_add_dnet_table_script(
  'ver1',
  'table1',
  'end_download_deletes',
  'TestScripts.Test.EndDownloadDeletes'
)

You may want to mark a row as deleted on the remote database. The following is the sample .NET method EndDownloadDeletes. It updates a consolidated database column called OnRemote to indicate that the record no longer resides on the remote database. The WHERE clause on the UPDATE matches the WHERE clause used for your download_delete_cursor event script.

public string EndDownloadDeletes( 
  DateTime timestamp, 
  string user, 
  string table) { 
  return( "UPDATE Leads SET OnRemote = 0 
     WHERE LastModified >= {ml s.last_table_download} 
     AND Owner = {ml s.username} AND DeleteFlag=1" ); 
}