--- Jeremy Neal Kelly <[EMAIL PROTECTED]> wrote:
> > The database has to be sorted to have a better performance.  The sorting
> is a
> > big pain.
> 
> Is sorting so difficult? I think it depends on the context.

In my case, the task is to sort items (directory or file)  in a directory tree.
 I have to make sure:

1. All the items in a directory should be placed right after that directory in
the database. 
2. The items in the same directory need to be sorted by name, size, date, etc.
3. When comparing dir and file in the same parent directory, the directory is
always larger.

For exmaple, "file1" and "file2" are in two different files like this:

"/doc/stuff/file2" and "/tmp/trash/old/file1".  How to compare these?

"file1" and "file2" cannot be compared directly.  It has to be compared at
root! In this case, if I want to sort by name, I have to compare "doc" and
"tmp".

This is the most weird thing I have done.  It does work quite nicely.  If I
want to retrieve a directory and all item in that directory, all I have to do
is to find the first one by searching through the database, then increment the
index one by one to get all the rest.

There are maybe better solutions for this.  For example, the way a real file
system is implemented. FAT, EXT2, NTFS...

So, to get what SU want.  It is possible to allocate a chunk in the database,
store the linklist in that chunk.  By doing so, there is no need to worry about
the sorting.

Max

=====
-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-
Got Palm?
Get ExBox at http://www.weirdwww.com/ExBox to beam anything!

__________________________________________________
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/

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