Product Documentation

c-treeDB API for C# - Developers Guide

Previous Topic

Next Topic

CTRecord.InsertBatch

Inserts a new record into a batch buffer.

Declaration

void CTRecord.InsertBatch();

Description

Inserts a new record into an internally maintained batch buffer. When the batch buffer fills up, the group of records stored in the batch buffer are inserted into the table. If CTRecord.EndBatch() is called and the batch buffer still contains records, a new insert record operation is performed for the remaining records before the batch operation is terminated.

For transaction controlled files, the batch insertion operation is treated as one all or nothing operation. If no explicit transaction is started, each insertion of records with will start and end its own transaction. Even if an explicit transaction is started, each insertion operation is treated independently through safe points.

Note: Currently, all record insertion operations do not perform any conversion of records images, key values, and record position for heterogeneous client/server implementations.

The following steps must be taken to perform a batch insert record operation:

  1. Call CTRecord.SetBatch() function, with CTBATCH_INS mode, to insert a group of records.

    For each record to be inserted perform the following operations:

    1. Call CTRecord.Clear() to clear a record buffer
    2. For each field in the record call SetFieldValue() or one of the deprecated CTRecord.SetFieldAs..() functions to set the field data.
    3. Call CTRecord.InsertBatch() to insert the record into the batch buffer.
  2. Call CTRecord.EndBatch() to indicate that no more records will be inserted.

In case of errors, CTRecord.InsertBatch() throws a CTException.

Return

void

See Also

CTRecord.BatchLocked(), CTRecord.BatchMode(), CTRecord.EndBatch(), CTRecord.IsBatchActive(), CTRecord.NextBatch(), CTRecord.SetBatch(), CTRecord.BatchLoaded, CTRecord.BatchTotal

TOCIndex