Product Documentation

FairCom DB API for C

Previous Topic

Next Topic

Terminating a batch operation

A batch operation must be terminated by calling the ctdbEndBatch() function. Once a batch operation is started, by calling ctdbSetBatch() no other batch operation is allowed to start until the current batch operation is terminated.

Example

/* set the partial target key */

ctdbClearRecord(hRecord);

ctdbSetFieldAsSigned(hRecord, 0, Invoice);

/* set the batch operation */

if (ctdbSetBatch(hRecord, CTBATCH_DEL, sizeof(Invoice), 0) != CTDBRET_OK)

printf("ctdbSetBatch failed with error %d\n", ctdbGetError(hRecord));

/* end the batch operation */

if (ctdbEndBatch(hRecord) != CTDBRET_OK)

printf("ctdbEndBatch failed with error %d\n", ctdbGetError(hRecord));

When performing batch retrieval operations, you may cancel the batch operation before retrieving all the records by calling ctdbEndBatch().

If the batch operation is a CTBATCH_RANGE then you must also call the ctdbRecordRangeOff() function to terminate the index range used for the batch operation.

TOCIndex