Page 2 of 2

PostPosted: Tue Jun 19, 2007 8:12 am
by samps
If you're creating the .PDBs from .CSVs on a 'normal' computer, then take advantage of the available processing power and sort the rows in the .CSVs, before you do any further. Then split the .CSVs into smaller ones, listig entries from , say: A to B, b to c, Aa - ah, whatever is more suited for your purpose.
Now, design your Palm app to use an index to find out which (much smaller) database to open in order to find what your searching for... Sort of a two-tiered approach.

Does that make any sense?


Ubuntu user #82

PostPosted: Tue Jun 19, 2007 9:26 am
by wahnsinn
Nice idea, but I think it won't help.

The problem is, the script must find all records, which contain the search string in one field on any place:


PostPosted: Wed Jun 20, 2007 10:23 am
by FrankG
Let's see your string search code and your db record reading code. Earlier you had this:

bool readRecord(int iRecord) {
// read the current record from the database
Database db;
DBRecord rec;
bool bRet = false;

// open the database
if("abodo", false)) {
if(db.getrec(iRecord, rec, true)) {, typeof(product), 1);
bRet = true;
return bRet;

I would not open and close the database every time you read a record. You could open it when your app starts and close it on exit.

How do you do the string search? Maybe post your code segment. You'd think strstr() would be much faster than "for loops" with substrings. You could experiment with various ways to search for "needle" in "longhaystackstring" by varying your algorithm:

- First search for "n" or "ne" and only look for the rest if that hits (maybe strstr works more quickly with a smaller find string than not. Maybe it doesn't matter.)

- Do you use substr a lot in the search process? Maybe save the substr to a string once and us it as you loop through the database.