Contents Index upload_old_row_insert table event upload_statistics table event

MobiLink Synchronization Reference
  Synchronization Events

upload_statistics connection event


Function 

Tracks synchronization statistics for upload operations.

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

None.

Description 

The upload_statistics event allows you to gather, for any user, statistics on uploads. The upload_statistics connection script is called just prior to the commit at the end of the upload transaction.

See also 

download_statistics connection event

download_statistics table 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 comes from an Oracle installation.

INSERT INTO upload_summary_audit (
id, ml_user, warnings, errors, inserted_rows,
deleted_rows, updated_rows, conflicted_inserts,
conflicted_deletes, conflicted_updates,
bytes, ignored_inserts, ignored deletes,
ignored_updates, bytes, deadlocks)
VALUES (usa_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 uploadStatisticsConnection as the script for the upload_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',
   'upload_statistics',
   'ExamplePackage.ExampleClass.uploadStatisticsConnection' )

Following is the sample Java method uploadStatisticsConnection. 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 uploadStatisticsConnection(
  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 UploadStats as the script for the upload_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',
  'upload_statistics',
  'TestScripts.Test.UploadStats'
)

Following is the C# signature for the call UploadStats.

public void UploadStats(
  string user,
  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_old_row_insert table event upload_statistics table event