Product Documentation

c-treeDB API API for C

Previous Topic

Next Topic

ctdbRecordRangeOff

Terminate a record index range operation established by ctdbRecordRangeOn().

Declaration

CTDBRET ctdbRecordRangeOff(CTHANDLE Handle);

Description

ctdbRecordRangeOff() terminate a range operation.

  • Handle is a record handle.

Return

Value

Symbolic Constant

Explanation

0

CTDBRET_OK

ctdbRecordRangeOff() returns CTDBRET_OK on success or c-treeDB API SDK error code on failure.

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

Example

/* display all records where age is greater than 65 */

void DisplayAll(CTHANDLE hRecord)

{

UTEXT lRange[32];

VRLEN lRangeLen = 32;

NINT op[1] = {CTIX_GT};

NINT fldno = ctdbGetFieldNumberByName(hHandle, "age");

CTDBRET eRet;

ctdbClearRecord(hRecord);

ctdbSetFieldAsSigned(hRecord, fldno, 65);

ctdbSetDefaultIndex(hRecord, 0);

ctdbBuildTargetKey(hRecord, CTFIND_EQ, lRange, &lRangeLen);

eRet = ctdbRecordRangeOn(hRecord, 1, lRange, NULL, op);

if (eRet == CTDBRET_OK)

{

eRet = ctdbFirstRecord(hRecord);

while (eRet == CTDBRET_OK)

{

TEXT str[128];

ctdbGetFieldAsString(hRecord, 0, str, sizeof(str));

printf("%s\n", str);

eRet = ctdbNextRecord(hRecord);

}

}

if (ctdbIsRecordRangeOn(hRecord))

ctdbRecordRangeOff(hRecord);

}

See also

ctdbRecordRangeOn(), ctdbIsRecordRangeOn()

TOCIndex