Contents Index begin_upload_deletes table event download_cursor cursor event

MobiLink Synchronization Reference
  Synchronization Events

begin_upload_rows table event


Function 

Processes statements related to a specific table just before uploading inserts and updates from the specified table in the remote database.

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. You must use parameter 1 if you want to use parameter 2.

Item Parameter Description
1 ml_username VARCHAR(128)
2 table VARCHAR(128)
Default action 

None.

Description 

This event is run immediately prior to applying the changes that result from inserts and deletes to the client table named in the second parameter.

You can have one begin_upload_rows script for each table in the remote database. The script is only invoked when the table is actually synchronized.

See also 

end_upload_rows table event

SQL example 

The begin_upload_rows connection event is used to perform whatever steps you need performed before uploading inserts and updates for a particular table. The following Adaptive Server Anywhere SQL script calls a stored procedure that prepares the consolidated database for inserts and updates into the Inventory table:

call ml_add_table_script(
 'MyCorp 1.0',
 'Inventory',
 'begin_upload_rows',
 'call PrepareForUpserts()' )
Java example 

The following stored procedure call registers a Java method called beginUploadRows as the script for the begin_upload_rows 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',
  'begin_upload_rows',
  'ExamplePackage.ExampleClass.beginUploadRows' )

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

public String beginUploadRows( String user,
String table )
  throws java.sql.SQLException
{  java.lang.System.out.println( "Starting upload rows
   for table: " + table + " and user: " + user );
   return( null ); }
.NET example 

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

Following is the C# signature for the call BeginUploadRows.

public void BeginUploadRows(
  string user,
  string table )

Contents Index begin_upload_deletes table event download_cursor cursor event