> The "cleaning up" dialog used during HotSync is for most users in the > Netherlands not that interesting.
It is a bit vague, but for many users, this is the appropriate level of detail. > After advice of a reader I use InsertionSort instead of QuickSort to keep my > database in order. You should choose the appropriate sort algorithm based on the circumstances. When re-sorting after a HotSync, insertion sort is usually preferably. When re-sorting with a different comparison function (eg. by company -> by last name), quick sort is usually preferable. > I tried to "tell" my appl. that there have to be a sorting by adding a last > record with that information. If your conduit modifies your database, HotSync will send your app a sysAppLaunchCmdSyncNotify launch code, at which point you can re-sort your database. You don't need any special "needs to be sorted" flag. > Now my appl. tests for the existance of a dummyDB. > I can use the dummy db the way you suggested but the modified records are > already in sorted order, the new records not. My advice was based on theory, not practice. If k << n, then O(k*log(k) + n) < O(n*log(n)). To turn this into practice, you'll need to implement a linear merge algorithm. Your inputs are: A: your original database with modified records removed B: your "dummy" database with modified and new record, which you just sorted Your output is: C: the merged database, which will replace your original database when you're done Start by creating C, giving it a different database name for now. Go through the records in A and B, advancing one or the other, depending on which is "smaller" according to your comparison function. You want to avoid copying the actual record contents, so you should detach the record from A or B, and then attach it to C. The problem is that this will trickle down the remaining record headers in A or B. So overwrite the existing record in A or B with a new empty record and then attach the overwritten handle to C. Or go through A and B in reverse order, but then you'll have to reverse C when you're done; I think this will be slightly faster. In either case, when you're done you'll have two "empty" databases: A and B. Delete them and rename C. I wouldn't bother with this complex algorithm unless you really need it. > It takes about 17 seconds to add a new record. Yikes! That's a long time. Have you profiled this to make sure you're only inserting one record? How many records are in your database? - Danny -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
