upload_delete table event

Provides an event that the MobiLink server uses during processing of the upload to handle rows deleted from the remote database.

Parameters

Parameter name for SQL scripts

Order

r.pk-column-1

1

... ...

r.pk-column-N

N

r.column-1

N + 1

... ...
r.column-M N + M
Default action

None.

Remarks

The statement-based upload_delete script handles rows that are deleted on the remote database. The action taken at the consolidated database can be a DELETE statement, but need not be.

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

For Java and .NET applications, this script must return valid SQL.

See also
SQL example

This example is taken from the Contact sample and can be found in Samples\MobiLink\Contact\build_consol.sql. It marks customers that are deleted from the remote database as inactive.

CALL ml_add_table_script(
  'ver1',
  'table1',
  'upload_delete',
  'UPDATE Customer 
   SET active = 0 
   WHERE cust_id={ml r.cust_id}' )
Java example

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

CALL ml_add_java_table_script(
  'ver1',
  'table1',
  'upload_delete',
  'ExamplePackage.ExampleClass.uploadDeleteTable' )

The following is the sample Java method uploadDeleteTable. It calls genUD which dynamically generates an UPLOAD statement.

public String uploadDeleteTable() {
  return( genUD(_curTable) ); 
}
.NET example

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

CALL ml_add_dnet_table_script(
  'ver1',
  'table1',
  'upload_delete',
  'TestScripts.Test.UploadDelete'
)

The following is the sample .NET method UploadDelete. It calls genUD which dynamically generates an UPLOAD statement.

public string UploadDelete( object pk1 ) {
  return( genUD(_curTable) ); 
}