This site requires web browsers to be at least version 4.
Visits (since August 2006)
visitors
visitors online
7- Index of functions
CPDB_AddRecord
err = CPDB_AddRecord(UInt8 iHandle)
Parameters : UInt8 iHandle : CPDB database handle, returned by CPDB_Open.
Description : Add a record to the database. Copy the current record and his modifications if a read operation or modifications have been previously made.
Use CPDB_Clear before call CPDB_AddRecord to add a blank record.
Return 0 if no error occured. Return CPDB_ERR_WRITEFAILED if write failed. Return CPDB_ERR_MEMORYERROR if the system refused the adding.
CPDB_Clear
err = CPDB_Clear(UInt8 iHandle)
Parameters : UInt8 iHandle : CPDB database handle, returned by CPDB_Open.
Description : Use CPDB_Clear before a use of CPDB_AddRecord, CPDB_UpdateRecord or the modification functions to be sure to work on a blank record.
Return 0 if no error occured.
CPDB_Close
err = CPDB_Close(UInt8 iHandle)
Parameters : UInt8 iHandle : CPDB database handle, returned by CPDB_Open.
Description : Close the database. To open a Database use CPDB_Open.
Parameters : UInt8 iHandle : CPDB database handle, returned by CPDB_Open. UInt16 *piValue : pointer on a UInt16 value, where the number of records will be written.
Description : Use CPDB_CoundRecord to get the number of record of the opened database.
Parameters : UInt8 iHandle : CPDB database handle, returned by CPDB_Open. UInt16 iCardNo : Number of the memory card of the Palm, use 0 for RAM. const Char *sName : Name of the database to create UInt32 iCreator : Creator ID, example : 'CPDB' const Char *sDescription : Description mask of the database structure
Description : Create a new database. If the database already exist, the function failed.
Description mask format : NAMEFIELD1=TYPE[SIZE];NAMEFIELD2=TYPE[SIZE];...
Types : SHORTINT : Short Int / 1 octet INT : Int / 2 octets LONGINT : Long Int / 4 octets STRING[SIZE] : String
Each field est separated by a ';' and described by a name, the sign '=', a type and the size between [] if type is STRING. The size his a "C" size, with the AsciiZ included. Warning : the sized if only provided for STRING fields.
Return 0 if no error occured. Return CPDB_ERR_INVALID the mask is invalid. Return CPDB_ERR_DATABASEALREADYEXIST if the database already exist. Return CPDB_ERR_CARDNOTPRESENT if iCardNo is not a valid memory card. Return CPDB_ERR_RAMONLYCARD if the specified card has no storage RAM. Return CPDB_ERR_NOTENOUGHSPACE if there is not enough memory.
CPDB_DatabaseExist
err = CPDB_DatabaseExist(const Char *sName)
Parameters : const Char *sName : Database name.
Description : Return 0 if the database exist or CPDB_ERR_NOEXIST if the database doesn't exist.
CPDB_DeleteRecord
err = CPDB_SupprimeEnregistrement(UInt8 iHandle)
Parameters : UInt8 iHandle : CPDB database handle, returned by CPDB_Open.
Description : Delete the current record in the database.
Return 0 if no error occured. Return CPDB_ERR_NOPREVREAD if there is no current record.
Parameters : UInt8 iHandle : CPDB database handle, returned by CPDB_Open.
Boolean *piFlag : pointer on a boolean value, where result of the last search operation will be written.
Description : After a browse operation, use CPDB_IsFound is used to get the search result. After execution piFlag value is 'true' if the search is successfull.
Return 0 if no error occured.
CPDB_IsOut
err = CPDB_IsOut(UInt8 iHandle, Boolean *piFlag)
Parameters : UInt8 iHandle : CPDB database handle, returned by CPDB_Open. Boolean *piFlag : pointer on a boolean value, where result will be written.
Description : After a search operation, use CPDB_IsOut is used to get the database cursor state. The "cursor" is the position of the last reading operation.
After execution piFlag value is 'true' if the cursor is successfully positionned.
CPDB_IsOut is very helpfull to browse a database or to verify the availability of the database cursor.
Parameters : UInt8 iHandle : CPDB database handle, returned by CPDB_Open.
const Char *sName : field name.
const Char*sValue : value to search in the field.
UInt8 iMode : search modes, see description.
Description : Search a value in a database field. If the field is numeric, a conversion is made.
iMode values : CPDB_SEARCH_REVERSE : the database is browsed in reverse way. CPDB_SEARCH_FROMCURRENT : the search is made from the current record. CPDB_SEARCH_UNTIL : find the value greater or egal (lower if CPDB_SEARCH_REVERSE)
For string field only : CPDB_SEARCH_WITHIN : search inside the string (default mode : "begin with") CPDB_SEARCH_CASELESS : no case sensitive (default mode : case sensitive)
Example : err = CPDB_Search(handleCustomers, "contry", "france", CPDB_SEARCH_WITHIN + CPDB_SEARCH_CASELESS);
Parameters : UInt8 iHandle : CPDB database handle, returned by CPDB_Open.
const Char *sName : field name.
const Int32 iValue : value to search in the field.
UInt8 iMode : search modes, see description.
Description : Search a numeric value in a database field. If the field type is less than Int32, a conversion is made, so beware of data loss.
iMode values : CPDB_SEARCH_REVERSE : the database is browsed in reverse way. CPDB_SEARCH_UNTIL : find the value greater or egal (lower if CPDB_SEARCH_REVERSE)
CPDB_SEARCH_FROMCURRENT : the search is made from the current record.
(other modes ignored)
Example : // Search next customer with field "year" = 2001.
Parameters : UInt8 iHandle : CPDB database handle, returned by CPDB_Open.
const Char *sName : field name.
UInt8 iDirection : sort direction, see description.
Description : Sort the database on a field. Big databases can take time to be sorted.
iDirection possible values: CPDB_SORT_ASC
CPDB_SORT_DESC
Note : the sort operation is a database modification, the database must be open in write mode.
Return 0 if no error occured.
CPDB_UpdateRecord
err = CPDB_UpdateRecord(UInt8 iHandle)
Parameters : UInt8 iHandle : CPDB database handle, returned by CPDB_Open. Description : Update the current record in the database. Valid the modifications made to the current record.
Return 0 if no error occured. Return CPDB_ERR_WRITEFAILED if write failed. Return CPDB_ERR_NOPREVREAD if there if no current record.