O'Reilly logo

Palm OS Programming, 2nd Edition by Neil Rhodes, Julie McKeehan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Moving Data to the Desktop

When you send data from the handheld to the desktop you have to read through the records of the remote database and translate them into appropriate structures on the desktop. Here is the step-by-step process, starting with the choices you have in how you read through the records.

Finding the Number of Records

SyncGetDBRecordCount finds the number of records in a database:

long SyncGetDBRecordCount(BYTE fHandle, WORD &rNumRecs);

Call it with:

WORD numRecords;
err = SyncGetDBRecordCount(rHandle, numRecords);

Reading Records

You can read records in a remote database using any of the following strategies:

  • Iterate through each record, locating the next altered record.

  • Look up exact records via unique record ID.

  • Read the nth record in the database.

We employ the last strategy for reading the records from our Sales order databases and the first strategy when we fully synchronize our customer list. There are a few points worth mentioning about each strategy.

Iterating through each record, stopping only for altered ones

If you want to iterate through the records and stop only on the ones that have been modified, use SyncReadNextModifiedRec. It retrieves a record from the remote database if the dirty bit in the record has been set.

A variation of this routine is SyncReadNextModifiedRecInCategory, which also filters based on the record’s category. This function takes the category index as an additional parameter.

Looking up exact records via unique record ID

Sometimes you ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required