>This means that heuristics will have to be used to verify that a dbID still >corresponds to the same database, like requiring a match on the database >name, creator ID and db type. This isn't guaranteed to work...
Fundamentally the problem is that a dbID is basically the same thing as a pointer, and is not intended for long-term storage since the underlying objects might move in memory. It happens to not move around much, which leads people to incorrectly assume that it is static, but that's not the case. And like for a pointer, even if you walk the database list to see if a given dbID is still valid, there's no guarantee that you're actually still talking about the same database as that dbID used to "mean", because when things moved you could possibly have had a different DB end up at the same location in memory. The only unique, unchanging identifier for a database at this time is its name. (Well, I suppose that can change too, but that's sort of a different matter. Is it the same database if you change all of its attributes and contents? What is the essence of database-ness? Do they have souls that need to be saved? Hmm...) Way back in 1.0 when this whole scheme was created, they didn't carefully define when and how the dbIDs could change, but I believe mostly we're talking about during a system reset and when databases get deleted. I can't swear to that, though. In newer versions of the OS (3.5 and higher? Or 4.0 and higher?), there are notifications sent out when databases are deleted, so you can use that to know that a dbID has become invalid. I think the reason that mechanism was added was to help things like the Launcher (and possibly you) who need to cache information like this for faster access. But that won't help over a reset, I don't think. Summary: avoid putting dbIDs in storage, just like you'd avoid putting a char * into storage. Similar problems apply to both. -David Fedor PalmSource, Inc. -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
