Newbie needs idea for 18000 data records

Discuss PocketC for Palm OS (including Desktop Edition)

Postby samps on Tue Jun 19, 2007 8:12 am

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
Ubuntu user #82
Posts: 143
Joined: Tue Feb 20, 2001 12:33 am
Location: Australia

Postby wahnsinn on Tue Jun 19, 2007 9:26 am

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:

Posts: 12
Joined: Tue Jun 05, 2007 2:19 pm

Postby FrankG on Wed Jun 20, 2007 10:23 am

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.

Posts: 210
Joined: Thu Jan 23, 2003 7:58 pm


Return to PocketC for Palm OS

Who is online

Users browsing this forum: No registered users and 1 guest