O'Reilly logo

Palm Programming: The Developer's Guide by Julie McKeehan, Neil Rhodes

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

Downloading to the Handheld

As we discussed earlier, there are several different ways that you might want to move data around during a synchronization. Let’s look at what is involved in moving data from the desktop to the handheld. This is commonly done with databases that are exclusively updated on the desktop and are routinely downloaded to handhelds where they aren’t modified. Or you may do this in the case that the user chooses “Desktop overwrites handheld” in the HotSync settings dialog (see Figure 11.3).

You need to create the database if it doesn’t yet exist. You should also delete any existing records before downloading the ones from the desktop. This is necessary because you don’t want the old ones; all you want are the newly downloaded ones.

Deleting Existing Records

There are a few different routines to choose from for deleting records:

SyncDeleteRec

Deletes one specific record

SyncPurgeAllRecs

Deletes all records

SyncPurgeAllRecsInCategory

Deletes all records from the specified category

SyncPurgeDeletedRecs

Deletes all records that have been marked as deleted or archived

In our particular case, SyncPurgeAllRecs is the call we want to use.

Writing Records

Once you have a nice, empty database, you can fill it up with fresh records from the desktop. You do this with the Sync Manager call SyncWriteRec.

                  SyncWriteRec (CRawRecordInfo &rInfo)

The parameter rInfo (of class CRawRecordInfo) contains several important fields:

m_FileHandle

Handle to the open database.

m_RecId

Input/output ...

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