Processes any statements just after the MobiLink server concludes processing uploaded inserts, updates, and deletes.
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. Using question marks has been deprecated and it is recommended that you use named parameters. 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 (deprecated for SQL) |
---|---|---|
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. |
1 |
None.
The MobiLink server executes this script as the last step in the processing of uploaded information. Upload information is processed in a single transaction. The execution of this script is the last action in this transaction before statistical scripts.
The following SQL Anywhere SQL script calls the EndUpload stored procedure.
CALL ml_add_connection_script( 'ver1', 'end_upload', 'CALL EndUpload({ml s.username});' ) |
The following call to a MobiLink system procedure registers a Java method called endUploadConnection as the script for the end_upload connection event when synchronizing the script version ver1.
CALL ml_add_java_connection_script( 'ver1', 'end_upload', 'ExamplePackage.ExampleClass.endUploadConnection' ) |
The following is the sample Java method endUploadConnection. It calls a method to perform operations on the database.
public String endUploadConnection( String user ) { // Clean up new and old tables. Iterator two_iter = _tables_with_ops.iterator(); while( two_iter.hasNext() ) { TableInfo cur_table = (TableInfo)two_iter.next(); dumpTableOps( _sync_conn, cur_table ); } _tables_with_ops.clear(); return ( null ); } |
The following call to a MobiLink system procedure registers a .NET method called EndUpload as the script for the end_upload connection event when synchronizing the script version ver1.
CALL ml_add_dnet_connection_script( 'ver1', 'end_upload', 'TestScripts.Test.EndUpload' ) |
The following is the sample .NET method EndUpload. It returns a SQL statement that calls the EndUpload stored procedure.
namespace TestScripts { public class Test { string _curUser = null; public string EndUpload( string user ) { return ( "CALL EndUpload({ml s.username});" ); }}} |
Discuss this page in DocCommentXchange.
|
Copyright © 2012, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.1 |