synchronization_statistics table event

Tracks synchronization statistics.

Parameters

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, but 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

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

Default action

None.

Remarks

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 prior to the commit at the end of the end synchronization transaction.

See also
SQL example

The following example inserts synchronization statistics into the sync_tab_audit table.

CALL ml_add_table_script(
  'ver1',
  'table1',
  '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.

Java example

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. (Note that logging statistics to the MobiLink message log might be useful at development time but would slow down a production server.)

public String synchronizationStatisticsTable(
  String user, 
  String table, 
  int warnings, 
  int errors ) {
  java.lang.System.out.println( "synch statistics for
   table: " + table + " errors: " + errors );
  return( null ); 
}
.NET example

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. (Note that logging statistics to the MobiLink message log might be useful at development time but would slow down a production server.)

public string SyncTableStats(
  string user,
  string table,
  int warnings,
  int errors ) {
  System.Console.WriteLine( "synch statistics for
   table: " + table + " errors: " + errors );
  return( null ); 
}