MobiLink Synchronization Reference
Synchronization Events
Tracks synchronization statistics.
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. For example, you must use parameter 1 if you want to use parameter 2.
Item | Parameter | Description |
---|---|---|
1 | ml_username | VARCHAR(128) |
2 | warnings | INTEGER |
3 | errors | INTEGER |
4 | deadlocks | INTEGER |
5 | synchronized_tables | INTEGER |
6 | connection_retries | INTEGER |
None.
The synchronization_statistics event allows you to gather, for any user and connection, various statistics about the current synchronization. The synchronization_statistics connection script is called just prior to the commit at the end of the end synchronization transaction.
download_statistics connection event
download_statistics table event
upload_statistics connection event
synchronization_statistics table event
time_statistics connection event
The following example comes from an Oracle installation.
INSERT INTO sync_con_audit( id, ml_user, warnings, errors, deadlocks, synchronized_tables, connection_retries) VALUES (s_audit.nextval,?,?,?,?,?,?)
Once statistics are inserted into the audit table, you may use these statistics to monitor your synchronizations and make optimizations where applicable.
The following stored procedure call registers a Java method called synchronizationStatisticsConnection as the script for the synchronization_statistics connection event when synchronizing the script version ver1. This syntax is for Adaptive Server Anywhere consolidated databases.
call ml_add_java_connection_script( 'ver1', 'synchronization_statistics', 'ExamplePackage.ExampleClass.synchronizationStatisticsConnection' )
Following is the sample Java method synchronizationStatisticsConnection. It logs some of the statistics to the MobiLink output log. (This might be useful at development time but would slow down a production server.)
public String synchronizationStatisticsConnection( String user, int warnings, int errors, int deadlocks, int synchronizedTables, int connectionRetries ) { java.lang.System.out.println( "synch statistics number of deadlocks: " + deadlocks ; return( null ); }
The following stored procedure call registers a .NET method called SyncStats as the script for the synchronization_statistics connection event when synchronizing the script version ver1. This syntax is for Adaptive Server Anywhere consolidated databases.
call ml_add_dnet_connection_script( 'ver1', 'synchronization_statistics', 'TestScripts.Test.SyncStats' )
Following is the C# signature for the call SyncStats.
public void SyncStats( string user, int warnings, int errors, int deadLocks, int syncedTables, int connRetries )