Provides access to synchronization statistics.
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.warnings |
INTEGER. The number of warnings that occurred for the table during the synchronization. |
3 |
s.errors |
INTEGER. The number of errors that were related to the table during the synchronization. |
4 |
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 synchronization_statistics event allows you to gather, for any user and table, the number of warnings and errors that occurred during synchronization. The synchronization_statistics table script is called just before the commit at the end of the end synchronization transaction.
The following example inserts synchronization statistics into the sync_tab_audit table.
CALL ml_add_table_script( 'ver1', 'table1', 'upload_insert', 'INSERT INTO sync_tab_audit ( ml_user, table, warnings, errors) VALUES ( {ml s.username}, {ml s.table}, {ml s.warnings}, {ml s.errors} ) ' ) |
Once synchronization statistics are inserted into the audit table, you may use these statistics to monitor your synchronizations and make optimizations where applicable.
The following call to a MobiLink system procedure registers a Java method called synchronizationStatisticsTable as the script for the synchronization_statistics table event when synchronizing the script version ver1.
CALL ml_add_java_table_script( 'ver1', 'table1', 'synchronization_statistics', 'ExamplePackage.ExampleClass.synchronizationStatisticsTable' ) |
The following is the sample Java method synchronizationStatisticsTable. It logs some of the statistics to the MobiLink message log. (Logging statistics to the MobiLink message log might be useful at development time but would slow down a production server.)
package ExamplePackage; public class ExampleClass { String _curUser = null; public void synchronizationStatisticsTable( String user, String table, int warnings, int errors ) { java.lang.System.out.println( "synch statistics for table: " + table + " errors: " + errors ); }} |
The following call to a MobiLink system procedure registers a .NET method called SyncTableStats as the script for the synchronization_statistics table event when synchronizing the script version ver1 and the table table1.
CALL ml_add_dnet_table_script( 'ver1', 'table1', 'synchronization_statistics', 'TestScripts.Test.SyncTableStats' ) |
The following is the sample .NET method SyncTableStats. It logs some of the statistics to the MobiLink message log. (Logging statistics to the MobiLink message log might be useful at development time but would slow down a production server.)
namespace TestScripts { public class Test { string _curUser = null; public void SyncTableStats( string user, string table, int warnings, int errors ) { System.Console.WriteLine( "synch statistics for table: " + table + " errors: " + errors ); }}} |
![]() |
Discuter à propos de cette page dans DocCommentXchange.
|
Copyright © 2013, SAP AG ou société affiliée SAP - SAP Sybase SQL Anywhere 16.0 |