Contents Index upload_statistics connection event upload_update table event

MobiLink Synchronization Reference
  Synchronization Events

upload_statistics table event


Function 

Tracks synchronization statistics for upload operations for a specific table.

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.

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 table VARCHAR(128)
3 warnings INTEGER
4 errors INTEGER
5 inserted_rows INTEGER
6 deleted_rows INTEGER
7 updated_rows INTEGER
8 conflicted_inserts INTEGER
9 conflicted_deletes INTEGER
10 conflicted_updates INTEGER
11 ignored_inserts INTEGER
12 ignored_deletes INTEGER
13 ignored_updates INTEGER
14 bytes INTEGER
15 deadlocks INTEGER
Default action 

None.

Description 

The upload_statistics event allows you to gather, for any user, vital statistics on synchronization happenings as they apply to any table. The upload_statistics table script is called just prior to the commit at the end of the upload transaction.

See also 

download_statistics connection event

upload_statistics connection event

upload_statistics table event

synchronization_statistics connection event

synchronization_statistics table event

time_statistics connection event

time_statistics table event

MobiLink Monitor

SQL Example 

The following example works with an Adaptive Server Anywhere consolidated database. It inserts a row into a table used to track upload statistics.

call ml_add_connection_script(
 'ver1',
 'upload_statistics',
 'insert into my_upload_statistics
    ( user_name, table_name, num_warnings, num_errors,
      inserted_rows, deleted_rows, updated_rows,
      conflicted_inserts, conflicted_deletes, conflicted_updates,
      ignored_inserts, ignored_deletes, ignored_updates,
      bytes, deadlocks )
    values( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )'  )

The following example works with an Oracle consolidated database.

INSERT INTO upload_tables_audit (
id, user_name, table, warnings, errors,
inserted_rows, deleted_rows, updated_rows,
conflicted_inserts, conflicted_deletes,
conflicted_updates, ignored_inserts, ignored_deletes,
ignored_updates, bytes, deadlocks)
VALUES ( ut_audit.nextval,
?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)

Once 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 stored procedure call registers a Java method called uploadStatisticsTable as the script for the upload_statistics table event when synchronizing the script version ver1. This syntax is for Adaptive Server Anywhere consolidated databases.

call ml_add_java_table_script(
  'ver1',
  'table1',
  'upload_statistics',
  'ExamplePackage.ExampleClass.uploadStatisticsTable' )

Following is the sample Java method uploadStatisticsTable. It logs some statistics to the MobiLink output log. (This might be useful at development time but would slow down a production server.)

public String uploadStatisticsTable(
  String user,
  int warnings,
  int errors,
  int insertedRows,
  int deletedRows,
  int updatedRows,
  int conflictedInserts,
  int conflictedDeletes,
  int conflictedUpdates,
  int ignoredInserts,
  int ignoredDeletes,
  int ignoredUpdates,
  int bytes,
 int deadlocks
)
{  java.lang.System.out.println( "updated rows: " +
   updatedRows ); }
.NET example 

The following stored procedure call registers a .NET method called UploadTableStats as the script for the upload_statistics table event when synchronizing the script version ver1 and the table table1. This syntax is for Adaptive Server Anywhere consolidated databases.

call ml_add_dnet_table_script(
  'ver1',
  'table1',
  'upload_statistics',
  'TestScripts.Test.UploadTableStats'
)

Following is the C# signature for the call UploadTableStats.

public void UploadTableStats(
  string user,
  string table,
  int warnings,
  int errors,
  int insertedRows,
  int deletedRows,
  int updatedRows,
  int conflictInserts,
  int conflictDeletes,
  int conflictUpdates,
  int ignoredInserts,
  int ignoredDeletes,
  int ignoredUpdates,
  int bytes,
  int deadlocks )

Contents Index upload_statistics connection event upload_update table event