Product Documentation

c-treeDB API API for C

Previous Topic

Next Topic

Batch Modes

You must specify one of the following Mandatory modes when calling the ctdbSetBatch() function or the CTRecord:SetBatch() method:

MODE

Description

CTBATCH_GET

Retrieve a group of related records by partial key

CTBATCH_RANGE

Retrieve a group of related records based on an index range expression

CTBATCH_PHYS

Retrieve records from a table in physical order. The starting record for the batch retrieval may be specified. (A physical order batch read is slightly faster than going through an index as it has fewer reads to do.)

CTBATCH_DEL

Delete a group of related records by partial key

CTBATCH_INS

Insert a group of records

The following modes are optional and can be OR-ed to the mandatory mode to specify other details on how the batch operation is to be performed.

Mode

Description

CTBATCH_GKEY

Process records with a greater than or equal key match with the target key. When this mode is specified, the number of matched records is not readily available. ctdbBatchLocked() and CTRecord::BatchLocked returns a value one greater than ctdbBatchLoaded() to indicate there may be more records to process.This mode is applicable only with CTBATCH_GET and CTBATCH_DEL modes and can not be used with CTBATCH_LKEY.

CTBATCH_LKEY

Process records that have a less than or equal key match with the target key.This mode is applicable only with CTBATCH_GET and CTBATCH_DEL modes and can not be used with CTBATCH_GKEY.

CTBATCH_VERIFY

Verify that the keys in the index match the values in the key fields of the record.

CTBATCH_LOCK_KEEP

Keep all records locked after ...EndBatch() is called. Without this mode, all records locks are released when ...EndBatch() is called. This option is only in effect when used with CTBATCH_LOCK_READ or CTBATCH_LOCK_WRITE.

CTBATCH_LOCK_READ

Place a read lock on each record that matches the partial key.

CTBATCH_LOCK_WRITE

Place a write lock on each record that matches the partial key.

CTBATCH_LOCK_BLOCK

Convert a CTBATCH_LOCK_READ or CTBATCH_LOCK_WRITE to blocking read and blocking write locks, respectively.

CTBATCH_LOCK_ONE

Implement an alternative locking strategy: only locks the record during the record read; original locking strategy keeps locks on during entire batch processing.

CTBATCH_COMPLETE

...SetBatch() returns a success code only if all matching records are successfully locked. You must specify either CTBATCH_LOCK_READ or CTBATCH_LOCK_WRITE.

TOCIndex