Previous Topic

Next Topic

AllocateRange

Allocate buffer space and establish a new range.

Short Name

ALCRNG()

Type

ISAM function

Declaration

COUNT AllocateRange(COUNT keyno, COUNT segcount, pVOID lRange, pVOID uRange, pCOUNT operators)

Description

AllocateRange() allocates buffer space and establish a new range based on the segment values passed on lower, upper and the operators for each segment. keyno identifies the index file that should be used to establish the range. segcount indicates the number of index segments values that should be used for setting the range, and the number of operators. lRange is a buffer with the lower range segment values, while uRange is a buffer with the upper range segment values. operators is an array of operators for each segment value.

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. The uRange buffer is ignored and may be set to NULL. For example,

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. 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.

Return

Value

Symbolic Constant

Explanation

0

NO_ERROR

Successful operation.

See c-tree Plus Error Codes for a complete listing of valid c-tree Plus error values.

Example

COUNT operators[] = {CTIX_BET, CTIX_BET};

if (AllocateRange(1, 2, buffer1, buffer2, operators) != NO_ERROR)
{
    printf("AllocateRange failed\n");
}

Limitations

Only the first operator in the array of operators is considered.

See also

FreeRange(), FirstInRange(), FirstInVRange, LastInRange(), LastInVRange, NextInRange(), NextInVRange, PreviousInRange, PreviousInVRange