No, it is not GUARANTEED to be unique -- not even within the same
database. It is just highly likely to be so. If you really need
guaranteed uniqueness you will need to create and maintain your
own ids. I find it handy, if using my own n-byte unique ids to store
them as the first n-bytes of every record, which makes sorting and
searching for them easier. Of course, the drawback of using your
own ids is mainly performance. Even if you keep your records sorted
on their ids (not always a viable option), you still take a performance
hit with each lock & unlock to find them.
For your information, the algorithm currently used by the data
manager to create ids is to randomly, at database creation time,
create a 24-bit seed value (with the bottom, least significant 13
bits zero) for each database, which is then incremented and used for ids.
Thus two different databases have an, approximately, 1 in 2048 chance of
starting with the same seed. On the other hand, if you keep a database
alive long enough and add (and, clearly, delete most of them) enough
records (more than 16,777,216 of them), you can most certainly get
collisions within the same database...
-bob mckenzie
-----Original Message-----
From: Rickard [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 19, 2001 6:22 AM
To: Palm Developer Forum
Subject: uniqueid
Im developing an application where I need to move records from different
databases and I have to keep the uniqueid that the record got when it was
created for the first time.
So my question to you is if you know if a records uniqueid is guaranteed to
be unique for all databases on the palm or only in the specific database
where the record is created/located.
/Rickard E
--
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/tech/support/forums/
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/