https://cpdb.ppcompiler.org/
Introduction
With CPDB, it's very simple to search on any field of the database. Search a string value on a 7000 records database take less than 4 seconds* !
* test done with a Zip code database on a Palm IIIxe device : search of the last record
Generic search
The first method consist with a generic search, a string value is used. You must convert to a string if the value is a numeric value.
Use the following example :
Err err; |
The bFound boolean contain true if the search succed.
Please note the CPDB_SEARCH_FROMCURRENT parameter. You can also use :
This permit to search all the records with a specific value. Just use CPDB_SEARCH_FROMBEGIN for the first search operation then loop on CPDB_SEARCH_FORMCURRENT to search the next record. This is an exemple :
Err err; |
Typed search
For a typed search, simply use :
Note : the size of the value is Int32, so please take care if you search on a SHORTINT or INT field, a conversion is done internaly.
To improve search performance and to browse you database in a correct order, it is usefull to sort the database on a specific field.
Use the following example :
err = CPDB_Sort(mydbHandle, "FIELDNAME", CPDB_SORT_ASC);
You can use CPDB_SORT_DESC for an inverse sort.
Warning : for a big database, this operation can take time. Display a waiting message is usefull. Example for a Zipcode database with 7000 records : less than 10 seconds with a Palm IIIxe.