CPDB.Net  [fr]  [en] 
News  Downloads  Forum
3- Browse operations



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
err = CPDB_ReadFirst(mydbHandle);
while (err == 0)
{
// Work on the record here
// ...
// Go to the next record
err = CPDB_ReadNext(mydbHandle);
}

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

CPDB_ReadFirst


CPDB_ReadNext


CPDB_ReadLast


CPDB_ReadPrevious


CPDB_SeekForward


CPDB_SeekBackward


CPDB_IsOut


Creation date : 01/10/2003 @ 06:20
Last update : 01/10/2003 @ 07:24
Category : CPDB library
Page read 7372 times

Top


GuppY - http://www.freeguppy.org/
Site running with GuppY v3.1 - GNU Public License - © 2002-2024

Page loaded in 0.02 second