Product Documentation

c-treeDB API for C++ - Developers Guide

Previous Topic

Next Topic

Retrieving records

If the mode of the batch operation is one of CTBATCH_GET, CTBATCH_RANGE or CTBATCH_PHYS then it may be necessary to retrieve all records that match the batch criteria. The records are retrieved by calling the CTRecord::NextBatch() method.

CTRecordNextBatch() retrieves record data from the batch buffer maintained by c-treeDB’s record handle. After a successful call to CTRecordNextBatch() the field data can be retrieved by calling the appropriate CTRecord::GetFieldAs...() functions.

Example

try

{

// retrieve records

while (CTRecord::NextBatch())

{

CTString invoice = hRecord.GetFieldAsString("Invoice");

CTString item = hRecord.GetFieldAsString("ItemNbr");

printf("%-11s %s\n", invoice.c_str(), item.c_str());

}

catch (CTException &err)

{

printf("Batch operation failed with error %d\n", err.GetErrorCode());

}

TOCIndex