Product Documentation

c-treeDB API API for C

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 ctdbNextBatch() function.

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

Example

/* retrieve records */

while (ctdbNextBatch(hRecord) == CTDBRET_OK)

{

TEXT invoice[32], item[32];

ctdbGetFieldAsString(hRecord, 0, invoice, sizeof(invoice));

ctdbGetFieldAsString(hRecord, 1, item, sizeof(item));

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

}

TOCIndex