Contents Index download_delete_cursor cursor event download_statistics table event

MobiLink Synchronization Reference
  Synchronization Events

download_statistics connection event


Function 

Tracks synchronization statistics for download 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). The MobiLink user name as specified in your SYNCHRONIZATION USER definition.
2 warnings INTEGER. The number of warnings issued.
3 errors INTEGER. The number of errors, including handled errors, that occurred.
4 fetched_rows INTEGER. The number of rows fetched by the download_cursor script.
5 deleted_rows INTEGER. The number of rows fetched by the download_deletes script.
6 filtered_rows INTEGER. The number of rows from (5) actually sent to the remote. This reflects download filtering of uploaded values.
7 bytes INTEGER. The number of bytes sent to the remote as the download.
Default action 

None.

Description 

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

Note: 
Depending on the command line, not all warnings or errors are logged, so the warnings and errors counts may be more than the number of warnings or errors logged.
See also 

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

INSERT INTO download_audit (id, user_name, warnings,
errors, deleted_rows, fetched_rows, download_rows, bytes)
VALUES (d_audit.nextval, ?,?,?,?,?,?,?)

Once vital 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 downloadStatisticsConnection as the script for the download_statistics event when synchronizing the script version ver1. This syntax is for Adaptive Server Anywhere consolidated databases.

call ml_add_java_connection_script( 'ver1', 'download_statistics', 'ExamplePackage.ExampleClass.downloadStatisticsConnection' )

Following is the sample Java method downloadStatisticsConnection. It prints the number of fetched rows to the MobiLink output log.

public String downloadStatisticsConnection(
  String user,
  int warnings,
  int errors,
  int fetchedRows,
  int deletedRows,
  int bytes )
{  java.lang.System.out.println( "download connection
   stats fetchedRows: " + fetchedRows );
   return( null ); }
.NET example 

The following stored procedure call registers a .NET method called DownloadStats as the script for the download_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',
  'download_statistics',
  'TestScripts.Test.DownloadStats'
)

Following is the C# signature for the call DownloadStats.

public void DownloadStats(
  string user,
  int warnings,
  int errors,
  int deletedRows,
  int fetchedRows,
  int downloadRows,
  int bytes )

Contents Index download_delete_cursor cursor event download_statistics table event