Processes statements at the end of the synchronization process.
In the following table, the description provides the SQL data type. If you are writing your script in Java or .NET, 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 are going 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 |
s.table |
VARCHAR(128). The table name. |
2 |
s.synchronization_ok |
INTEGER. This value is 1 for a successful synchronization and 0 for an unsuccessful synchronization. |
3 |
s.script_version | VARCHAR(128). Optional IN parameter to specify that the MobiLink server passes the script version string used for the current synchronization to this parameter. Question marks cannot be used to specify this parameter. | Not applicable |
None.
The MobiLink server executes this script after an application has synchronized and is about to disconnect from the MobiLink server, and before the connection level script of the same name.
You can have one end_synchronization script for each table in the remote database.
The following SQL Anywhere SQL script drops a temporary table created by the begin_synchronization script.
CALL ml_add_table_script( 'ver1', 'sales_order', 'end_synchronization', 'DROP TABLE #sales_order' ) |
The following call to a MobiLink system procedure registers a Java method called endSynchronizationTable as the script for the end_synchronization table event when synchronizing the script version ver1.
CALL ml_add_java_table_script( 'ver1', 'table1', 'end_synchronization', 'ExamplePackage.ExampleClass.endSynchronizationTable' ) |
The following is the sample Java method endSynchronizationTable.
package ExamplePackage; import ianywhere.ml.script.*; import java.sql.*; public class ExampleClass { private DBConnectionContext _cc = null; public ExampleClass( DBConnectionContext cc ) { _cc = cc; } public void endSynchronizationTable() throws SQLException { try( Connection conn = _cc.getConnection() ) { try( PreparedStatement stmt = conn.prepareStatement( "DROP TABLE #sales_order" ) ) { stmt.executeUpdate(); } } } } |
The following call to a MobiLink system procedure registers a .NET method called EndTableSync as the script for the end_synchronization table event when synchronizing the script version ver1 and the table table1.
CALL ml_add_dnet_table_script( 'ver1', 'table1', 'end_synchronization', 'TestScripts.Test.EndTableSync' ) |
The following is the sample .NET method EndSynchronizationTable.
using iAnywhere.MobiLink.Script; namespace TestScripts { public class ExampleClass { DBConnectionContext _cc = null; ExampleClass( DBConnectionContext cc ) { _cc = cc; } public void EndSynchronizationTable() { DBConnection conn = _cc.GetConnection(); try { DBCommand cmd = conn.CreateCommand(); try { cmd.CommandText = "DROP TABLE #sales_order"; cmd.Prepare(); cmd.ExecuteNonQuery(); } finally { cmd.Close(); } } finally { conn.Close(); } } } } |
![]() |
Discuss this page in DocCommentXchange.
|
Copyright © 2014, SAP AG or an SAP affiliate company. - SAP Sybase SQL Anywhere 16.0 |