MobiLink generates and uses a timestamp for timestamp-based downloads based on the following criteria.
After an upload is committed and immediately before invoking the prepare_for_download event, the MobiLink server fetches the current time from the consolidated database and saves the value. This TIMESTAMP value represents the start time of the current download; the next synchronization should only download data that changes after this time.
the current time
the start of the oldest open transaction
The MobiLink server sends this TIMESTAMP value as part of the download, and the client stores it.
The next time the client synchronizes, it uses the TIMESTAMP value for the last_download_timestamp that it sends with the upload.
The MobiLink server passes the last_download_timestamp that the client just uploaded into your download scripts. Your scripts can then select changes with timestamps that are newer or equal to the last last_download_timestamp to ensure that only new changes are downloaded.
The last download time is stored on the remote database. This is the appropriate place because only the remote database knows if the download has been successfully applied.
For SQL Anywhere remotes, the last download time is stored per subscription and can be viewed using the SYSSYNC system view.
For UltraLite remotes, the last download time is stored per publication in the syspublication system table.
In some rare circumstances you may want to modify the last_download_timestamp. For example, if you accidentally delete all the data on a remote database, you can download it again by defining a modify_last_download_timestamp connection script to reset the value for the last download timestamp. There are other events, called generate_next_last_download_timestamp and modify_next_last_download_timestamp, which you can use to set the timestamp not for the current synchronization but for the next synchronization. For example, if you wanted to use a UTC TIMESTAMP value to compare to UTC values in the last_modified columns of your tables.
UltraLite also provides functionality to change the last download time from the remote with the following methods: