At 9:42 AM -0800 12/16/99, Sudipta Ghose wrote:
>2. Store the record index in the Index DB. This should give very fast access to the
>record. But, I have to update the index DB, every time I add or delete records.
Consider using this approach in conjunction with a more reliable one. If the index is
correct, use it. Don't worry about updating indices except when you try to use them
and discover they're wrong. You might even want to scan the records nearby since that
will often find the desired record.
>3. Store the unique ID of the record in the index DB. This will get rid of the update
>problem. But, it seems DmFindRecordByID does a linear search thru the database
>header. For large number of records this may take a while.
It's a fast O(n). The unique IDs are preserved in all recent OS/HotSync versions,
although we don't have confirmation yet from Palm on the Mac HotSync. (This was
discussed in another thread.)
>4. Store the local ID of the record in the index DB. This will get rid of the update
>problem(??). Also, I can get very fast access to the record data by converting the
>local ID to a locked pointer. This seems to be the most efficient method. But, I am
>not sure if the local ID of a record changes while updating the database. Do you
>think this will work or there could be any other problem?
Local IDs will be different after a HotSync, hard reset, HotSync. Also, the database
manager makes no guarantees about these local IDs being preserved, so you're treading
on thin ice.
This is one of the more interesting challenges Palm OS programmers face. :)
-
Danny Epstein, Applied Thought Corporation
Have friends with Palm organizers? Get BeamBooks!
http://www.appliedthought.com/beambooks