Home > Archive > SQL Anywhere Mobile > May 2005 > LastModified column









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author LastModified column
Ron van der Wiele

2005-05-08, 8:24 pm

I want to synchronize between handheld and desktop, now i have on the server
(desktop) in the table I want to synchronize an extra column 'LastModified'
(timestamp). That was told me by someone.
Now the question is; has that column any function? Must I fill the column
myself with a timestamp if any data gets changed, must that column also be
on the handheld (remote) table?
I myself can't see any use for that column other than to see what the last
modification timestamp is (but will it also be used in that way by
mobilink?).
If someone can enlighten me :)
Ron



Greg Fenton

2005-05-09, 3:24 am

Ron van der Wiele wrote:
> I want to synchronize between handheld and desktop, now i have on the server
> (desktop) in the table I want to synchronize an extra column 'LastModified'
> (timestamp). That was told me by someone.


You do *not* want to synchronize the LastModified column. This is a
column that you put into the table on the consolidated (only) and do not
have in the remote database.

> Now the question is; has that column any function? Must I fill the column
> myself with a timestamp if any data gets changed, must that column also be
> on the handheld (remote) table?


If your consolidated database is a SQLAnywhere (ASA) database, then if
you define the column as:

last_modified TIMESTAMP DEFAULT TIMESTAMP

it will be maintained for you automatically. The DEFAULT TIMESTAMP
tells the database engine to update that column's value whenever the row
is inserted or updated (as long as a value is *not* provided for that
column).

For non-SQLAnywhere consolidateds, you'd typically use a trigger to do
the same.

This column is used for the "timestamp-based synchronization" technique.
In the ASA 8.x online docs, see:

MobiLink Synchronization User's Guide
4. Synchronization Techniques
- Timestamp-based synchronization

> I myself can't see any use for that column other than to see what the last
> modification timestamp is (but will it also be used in that way by
> mobilink?).


MobiLink itself will not use the column. However, *your*
synchronization scripts can. Typically you use this in your
download_cursor (and download_delete_curs
or) scripts to identify the
rows that have been modified since the last time the current remote had
synchronized:

SELECT col1, col2, ... FROM mytable
WHERE last_modified >= ?

The above WHERE clause retrieves only those rows from "mytable" that
have been modified from since the previous synchronization by this
remote. For the events download_cursor and download_delete_curs
or, the
"?" is replaced by MobiLink by the value "last_download", the timestamp
of the last time the current remote synchronized.

In the ASA 8.x online documentation, see:

MobiLink Synchronization User's Guide
3. Writing Synchronization Scripts
Writing scripts to download rows
- Writing download_cursor scripts

and

MobiLink Synchronization User's Guide
20. Synchronization Events
- download_cursor cursor event

Hope this helps,
greg.fenton
--
Greg Fenton
Consultant, Solution Services, iAnywhere Solutions
--------
Visit the iAnywhere Solutions Developer Community
Whitepapers, TechDocs, Downloads
http://www.ianywhere.com/developer/
Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com