Bill Goodman wrote:
> 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.

"Challenging" is putting it mildly.  I take this approach: I use unique
IDs, because I need the performance, but I also store a copy of the
unique ID in the record itself.  Then when my app receives a
sysAppLaunchCmdSyncNotify, indicating a "restore" has happened, I run
thru all the records and use DmSetRecordInfo to set the UID back to what
it originally was.

Another problem, which doesn't seem to be well known, is that unique IDs
are NOT guaranteed to be unique.  It is possible for the OS to assign
the same "unique" ID to two different records in a database.  This is
normally unlikely, but the more "restore" operations that happen on a
database, the more likely it becomes.  Certain usage patterns can make
it more likely also; if you create one record and leave it alone
forever, and then create and delete more records, you are *guaranteed*
that you'll eventually get another record with the same UID as the first
one.
--Mark

Reply via email to