Page loading

  
    
     
trans

 

CPDB.Net

 

[fr]
trans
[en]

 

Welcome
Welcome

 

News
News

 

Downloads
Downloads

 

Stats
Stats

 

 

Admin
Admin

trans

Return to :

PPCompiler

trans

Index

CPDB library
1- Add CPDB support to your application
2- Open and close databases
3- Browse operations
4- Fields operations
5- Functions of modification of a database
6- Sort and search operations
7- Index of functions
8- Error codes
Documentation
CPDB Conduit
CPDB Features

trans

Preferences

Your name : Guest


Users online

( nobody )

trans

Webmaster

Webmaster : Palmipod

E-mail : phc­@­palmipod­.­com

This site requires web browsers to be at least version 4.

trans

trans

6- Sort and search operations



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;
Boolean bFound;



err = CPDB_Search(mydbHandle, "FIELDNAME", "1234", CPDB_SEARCH_FROMCURRENT);
err = CPDB_IsFound(mydbHandle, &bFound);

The bFound boolean contain true if the search succed.


Please note the CPDB_SEARCH_FROMCURRENT parameter. You can also use :



  • CPDB_SEARCH_REVERSE
  • CPDB_SEARCH_FROMCURRENT
  • CPDB_SEARCH_WITHIN
  • CPDB_SEARCH_CASELESS

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;
Boolean bFound;



err = CPDB_Search(mydbHandle, "FIELDNAME", "1234", 0);
err = CPDB_IsFound(mydbHandle, &bFound);


while ( bFound == true && err == 0 )
{
// your code here
// ...
// Next record
err = CPDB_Search(mydbHandle, "FIELDNAME", "1234", CPDB_SEARCH_FROMCURRENT);
if (err == 0) err = CPDB_IsFound(mydbHandle, &bFound);
}

Typed search


For a typed search, simply use :



  • CPDB_SearchNumeric : search in the database with a numeric value

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.



Sort your database


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.



More information


CPDB_Search


CPDB_SearchNumeric


CPDB_IsFound


CPDB_Sort


Creation date : 01/10/2003 @ 06:49
Last update : 01/10/2003 @ 07:36
Category : CPDB library
Page read 6787 times

Print previewPrint preview

  

Print the pagePrint the page

CPDB.net Library

This PalmOS library is compiled in C. It is provided with its .h file and documentation.


The library can be used by all applications developed with CodeWarrior, Falch.net or PRC-Tools.


Included :
Generic conduit for CPDB.net and CPDBWizard


The generic conduit CPDBConduit allows to convert a PC database in a CSV-like format into a Palm database (CPDB format).


CPDBWizard enables you to describe your data bases and generates for you the source code necessary to their exploitation.

trans

Search

trans

trans

Visits (since August 2006)

  visitors

  visitor online

trans

trans

Top

trans

GuppY - http://www.freeguppy.org/
Site running with GuppY v3.0p5mod - GNU Public License - 2002-2004

trans

Page loaded in 0.1 second