The timestamp method is the most useful general technique for efficient downloads. This technique involves tracking the last time that each user synchronized and only downloading rows that have changed since then.
MobiLink maintains a TIMESTAMP value indicating when each MobiLink user last downloaded data. This value is called the last download time.
The timestamp-based synchronization is implemented.
The following example, taken from the MobiLink Contact sample, is an illustration of how you can implement a timestamp-based download.
Table definition:
CREATE TABLE "DBA"."Customer"( "cust_id" integer NOT NULL DEFAULT GLOBAL AUTOINCREMENT, "name" char(40) NOT NULL, "rep_id" integer NOT NULL, "last_modified" timestamp NULL DEFAULT timestamp, "active" bit NOT NULL, PRIMARY KEY ("cust_id") )
download_cursor script:
SELECT cust_id, Customer.name, Customer.rep_id FROM Customer KEY JOIN SalesRep WHERE Customer.last_modified >= {ml s.last_table_download} AND SalesRep.ml_username = {ml s.username} AND Customer.active = 1