Product Documentation

c-treeDB API for C++ - Developers Guide

Previous Topic

Next Topic

CTRecord::RangeOn

Establish a new index range on a record handle.

Declaration

void CTRecord::RangeOn(NINT SegCount, pVOID lRange, pVOID uRange, pNINT operators)

Description

CTRecord::RangeOn() establishes a new range based on the key segment values passed on lRange and uRange buffers, and the operators for each segment. Once the range is set, use CTRecord::First(), CTRecord::Next(), CTRecord::Prev() and CTRecord::Last() to navigate the records in the specified range. The range is set for all index entries that are situated between the lower bounds and upper bounds values. The segment values are stored in lRange and uRange buffers in the same order and type of the index segment definition. If a previous range exists for this index, the previous range is released and the new range is established. Ranges take precedence over sets. If a record handle has a set established, record from a range will fetched instead of records from a range. Once the range is terminated, the records from a set is established.

  • SegCount indicates the number of index segments values that should be used for setting the range, and the number of operators, since there must be one operator for each key segment in lRange and/or uRange.
  • lRange is a buffer with the lower range segment values. Use the function CTRecord::BuildTargetKey() to build the lRange buffer.
  • uRange is a buffer with the upper range segment values. Use the function CTRecord::BuildTargetKey() to build the uRange buffer.
  • operators operators is an array of operators. There must be one operator for each key segment in lRange and/or uRange. The operators CTIX_EQ, CTIX_NE, CTIX_GT, CTIX_GE, CTIX_LE, CTIX_LT are open ended and use only the lRange buffer for range values and the equivalent key segment in uRange is ignored and maybe set to null (ascii \0 values). The operators CTIX_BET, CTIX_BET_IE, CTIX_BET_EI, CTIX_BET_EE and CTIX_NOTBET use both lRange and uRange buffers to establish the lower and upper bound values.

Return

Value

Symbolic Constant

Explanation

0

CTDBRET_OK

CTRecord::RangeOn() returns CTDBRET_OK on success or c-treeDB SDK error code on failure.

See "c-treeDB Errors and Return Values" for a complete listing of valid c-treeDB error codes and return values.

See also

CTRecord::RangeOff(), CTRecord:IsRangeOn()

TOCIndex