> 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).

I think that a fair definition of "bug" is "software operating in a manner
inconsistant with its specification".  Is DmDatabaseInfo specified to accept
invalid LocalIDs?  I don't think it is, so this isn't a bug.

Operating systems often don't perform extended error checking on their inputs.
That's because the alternative is simple: make it so that the clients of the
operating system don't pass in invalid data.  The reason why error checking of
parameters is not done is because it often slows down OS execution.  That's why
we distribute our ROMs in debug (error checking) and release (reduced error
checking) versions.

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

Well, I'm no Database Manager expert, but if I were tasked with making it so
that DmDatabaseInfo checked the LocalID first, then I would essentially have to
iterate over all the installed databases, comparing to their LocalIDs.  So the
OS would only be doing the same thing you're trying to avoid.  And if you think
it's too slow for your application, wouldn't it also be too slow for the OS?

BTW: how many databases are on your system, and how long does it take to iterate
over them?  You say that it's too slow; I'm just curious as to how slow is too
slow.

-- Keith



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

Reply via email to