Contents Index upload_delete table event upload_insert table event

MobiLink Synchronization Reference
  Synchronization Events

upload_fetch table event


Function 

Provides an event that the MobiLink synchronization server uses to identify update conflicts during statement-based processing of the upload stream.

Parameters 
Item Parameter
1 primary key 1
2 primary key 2
... ...
Default action 

None.

Description 

The statement-based upload_fetch script fetches rows from a synchronized table for the purposes of conflict detection. It is a companion to the upload_update event.

The columns of the result set must match the number of columns being uploaded from the remote database for this table. If the values returned do not match the before image in the uploaded row, a conflict is identified.

You can have one upload_fetch script for each table in the remote database.

See also 

resolve_conflict table event

upload_delete table event

upload_insert table event

upload_update table event

SQL example 

The following SQL script is taken from the Contact sample and can be found in Samples\MobiLink\Contact\build_consol.sql. It is used to identify conflicts that occur when rows updated in the remote database Product table are uploaded. This script selects rows from a table also named Product, but depending on your consolidated and remote database schema, the two table names may not match.

SELECT id, name, size, quantity, unit_price
FROM Product WHERE id=?
Java example 

This script must return valid SQL.

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

Following is the sample Java method uploadFetchTable. It dynamically generates an UPLOAD statement.

public string uploadFetchTable()
{  return( genUF(_curTable) ); }

Contents Index upload_delete table event upload_insert table event