Contents Index end_download table event end_download_rows table event

MobiLink Synchronization Reference
  Synchronization Events

end_download_deletes table event


Function 

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.

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

None.

Description 

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.

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 

begin_download_deletes table event

end_download connection event

begin_download_rows table event

end_download_rows table event

SQL example 

You may want to mark a row as deleted on the remote database in this event, using a WHERE clause on the UPDATE that matches the WHERE clause used for your download_delete_cursor.

Call ml_add_table_script(
  'version1',
  'Leads',
  'end_download_deletes',
  'UPDATE Leads SET OnRemote = 0
      WHERE LastModified > ?
        AND Owner = ? AND DeleteFlag=1');
Java example 

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

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

Following is the sample Java method endDownloadDeletes. It returns the end_download_deletes SQL statement. MobiLink will execute this statement.

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

The following stored procedure call 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. This syntax is for Adaptive Server Anywhere consolidated databases.

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

Following is the C# signature for the call EndDownloadDeletes.

public void EndDownloadDeletes( 
  DateTime timestamp, string user, string table )

Contents Index end_download table event end_download_rows table event