>I have the following situation: I have a LocalID and I have to check whether
>there is a database with that ID available. I thought DmDatabaseInfo() would
>just fail if there is no such database, but it crashes (which I consider a
>bug in PalmOS).

That's not surprising at all that it crashes.  A LocalID is (in the current
implementation) nothing more than a pointer slightly disguised and
dressed-up.  There's no good/fast/safe way for the system to determine if
the given LocalID is valid, any more than it is possible for the system to
check that a pointer you gave does indeed point to a valid string.
(Sometimes heuristics are possible, but they're not foolproof.)

The OS intentionally doesn't do a ton of validation checking, particularly
not in the release rom.  That sort of thing would introduce a lot of
overhead... so you're not allowed to pass garbage in and not expect to get
garbage out - but in this case the garbage is an excessively bad result!


>Now, is there another way to make a fast check? I do not want to enumerate
>all databases, this is too slow.

No.  LocalIDs are not intended for long-term storage; use the database name
or type/creator pair instead.  Particularly in more recent versions of the
OS, getting a database from the name or type/creator is pretty fast.

-David Fedor
Palm Developer Support



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palm.com/devzone/mailinglists.html

Reply via email to