Introduction
With CPDB you can browse your databases in any direction, with very simple functions.
Browse in simple way
To browse your database simply use this example :
// Read the first record |
The loop will end when CPDB_ReadNext return an error, you must verify this error, it must be a CPDB_ERR_EOF error. You can browse in the inverse direction by using CPDB_ReadLast and CPDB_ReadPrevious functions, the error will be CPDB_ERR_BOF.
Browse page by page
To browse page by page, use the CPDB_SeekForward and CPDB_SeekBackward functions. This example seek 10 records in one operation :
err = CPDB_SeekForward(mydbHandle, 10);
Note ; if the end (or begin) of the file is reached, the read operation is canceled, you must do a CPDB_ReadFirst (or Last) to complete the operation.
Browse information
A any time it is possible to know if the last browse operation have succeded, use the CPDB_IsOut function :
Boolean boolIsOut; err = CPDB_IsOut(iHandle, &boolIsOut);
If boolIsOut contain true, the last browse operation have failed, and no record is currently readed.
More information