At 10:04 AM 6/22/99 -0700, you wrote:
>Ion Popescu wrote:
>
>>I still haven't got the answer to the question I posted.
>>I guess the thread got into discussing what is expected
>>out of Palm. My question again:-
>>
>>Should I write a replacement for DmFindRecordByID?
>
>The main problem as I recall occurs when you do a "restore" operation after
>a hard reset. The unique IDs for records get regenerated from scratch and
>have no relationship whatsoever to the original IDs.
>
>As a result, building an efficient linked list of database records is quite
>challenging. You can't use the standard PalmOS unique IDs. One method is to
>put your own unique ID inside each record; however, this has its own
>problems. For one, the performance is quite poor since you have to look
>inside each record when you are scanning for a particular ID (the PalmOS
>unique ID lookup is relatively fast since all the IDs are in a single
>array).
If you sort the database by ID, you regain performance. All searches
become O(log n) rather than O(n).
(In which case DnFindRecordByID becomes DmBinarySearch). Unfortunately,
some databases don't lend themselves to being sorted.