MobiLink Synchronization Reference
Synchronization Events
Processes statements related to a specific table just before uploading deleted rows from the specified table in the remote database.
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 | ml_username | VARCHAR(128) |
2 | table | VARCHAR(128) |
None.
This event runs immediately before applying the changes that result from rows deleted in the client table named in the second parameter.
You can have one begin_upload_deletes script for each table in the remote database. The script is only invoked when the table is actually synchronized.
end_upload_deletes table event
The begin_upload_deletes connection event is used to perform whatever steps you need performed after uploading inserts and updates for a particular table, but before deletes are uploaded for that table. The following Adaptive Server Anywhere SQL script creates a temporary table for storing deletes temporarily during upload:
call ml_add_table_script( 'ver1', 'sales_order', 'begin_upload_deletes', 'CREATE TABLE #sales_order_deletes ( id integer NOT NULL default autoincrement, cust_id integer NOT NULL, order_date date NOT NULL, fin_code_id char(2) NULL, region char(7) NULL, sales_rep integer NOT NULL, PRIMARY KEY (id), )' )
The following stored procedure call registers a Java method called beginUploadDeletes as the script for the begin_upload_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', 'begin_upload_deletes', 'ExamplePackage.ExampleClass. beginUploadDeletes' )
Following is the sample Java method beginUploadDeletes. It prints a message to the MobiLink output log. (This might be useful at development time but would slow down a production server.)
public String beginUploadDeletes( String user, String table ) throws java.sql.SQLException { java.lang.System.out.println( "Starting upload deleted for table: " + table ); return( null ); }
The following stored procedure call registers a .NET method called BeginUploadDeletes as the script for the begin_upload_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', 'begin_upload_deletes', 'TestScripts.Test.BeginUploadDeletes' )
Following is the C# signature for the call BeginUploadDeletes.
public void BeginUploadDeletes( string user, string table )