Product Documentation

c-treeDB API for C++ - Developers Guide

Previous Topic

Next Topic

Terminating a batch operation

A batch operation must be terminated by calling the CTRecord::EndBatch() method. Once a batch operation is started, by calling the CTRecord::SetBatch() method no other batch operation is allowed to start until the current batch operation is terminated.

Example

try

{

// set the partial target key

hRecord.Clear();

hRecord.SetFieldAsSigned("Invoice", Invoice);

// set the batch operation

hRecord.SetBatch(CTBATCH_DEL, sizeof(Invoice), 0);

// end the batch operation

hRecord.EndBatch();

}

catch (CTException &err)

{

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

}

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

If the batch operation is a CTBATCH_RANGE then you must also call the CTRecord::RangeOff() method to terminate the index range used for the batch operation.

TOCIndex