Ben Combee wrote:
Good call with this one. Alessandro, this is definitely the way you want to go (assuming you don't buy an RDBMS for Palm). And with the way Palm PDBs work, it would be quite easy. You could easily strip this down to a Find(), Read(), Write(), Add() interface for the rest of your program. Wow. Again, nice call, Ben.At 17:31 2002-11-21 -0800, you wrote:> Ho do you keep the records sorted in an efficent way? That's not a concern in my case, because the database is read-only. I provide a pre-sorted database (pdb) to my users on a regular basis. If you have updates on the handheld, you could probably just find the correct position on the sorting order using DmFindSortPosition and then insert the new record(s).
This looks like a job for Computer Science!
If you look at b-tree algorithms, you may be able to find some ideas that would work for you. They work like a binary tree, except that each node has multiple records, and can have multiple children. One idea is that each node has a maximum size, and there are operations that are done to split nodes if they grow too large, and combine nodes when they get too small. Since the whole tree still observes a sorted nature, finds are fast, very quickly resulting in finding the node that has the item if present.
There are a nunber of variations, but I'd bet a linear b-tree node handling algorithm would work pretty well.
Matt
--
For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
