Aha!  "I sorted the DB in three ways and stored uid of records."  

If you want fast access to your records, you must access them through record
number, not UID.  DmFindRecordByUID does a STUPID, top down search for a
record with the passed in UID (of course, it cannot do anything else), so
each access is O(n).  

Thus keep AND maintain, for each sort key, a vector of record indexes.
Also, for quick access of the key index, allocate enough space for the
entire vector and manipulate it as a whole.  This approach is, performance
wise, the best you can expect on the PalmOS if you need multiple keys.  It
is neither simple nor of low overhead, however.

-bob mckenzie

-----Original Message-----
From: Wocjciech Gody�ski [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 30, 2001 7:53 AM
To: Palm Developer Forum
Subject: Re: Searching records




Holger Klawitter wrote:

> > There is only one problem for me yet.
> > I want my DB to be sorted in three ways.
> > I cannot sort on demand (because of amount of records).
> > What is the way to do that?
>
> Palm OS itself does not provide support for that. But you can
> create an index DB yourself (at 1st launch after HotSync
> for example). The optimal way of implementing it strongly depends
> on your data and sorting key sizes, of course.

Yes. I've done this.
But I cannot do a binary search (as I think).
I sorted the DB in three ways and stored uid of records.
But when searching thru records I have to query for each record (it takes
long time).

Q: how does PalmOS stores sort info in database header?
     I've been  looking thru Reference for long time, but cannot solve it.
      Can't I save sortinfo for each sort order and swap it on demand ?

Thanks for Answer
Wojtek


-- 
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/

Reply via email to