Product Documentation

c-treeDB API API for C

Previous Topic

Next Topic

ctdbGetIdxnoByNumber

Retrieve the index file number from a table handle.

DECLARATION

NINT ctdbGetIdxnoByNumber(CTHANDLE Handle, NINT index)

DESCRIPTION

Retrieves the index file number to be used with c-tree ISAM and low-level index functions.

  • Handle is a table handle.
  • index is a c-treeDB API index number. The first c-treeDB API index number is zero.

Returns the index number on success or -1 on failure. If ctdbGetIdxnoByNumber() returns -1, the error code can be retrieved by calling ctdbGetError() function.

RETURN

Value

Symbolic Constant

Explanation

0

NO_ERROR

No error occurred.

-1

 

ctdbGetDIdxnoByNumber() failed. You can retrieve the error code by calling ctdbGetError() function.

See Appendix A for a complete listing of valid c-tree Plus error values.

EXAMPLE

/* retrieve the first key of first index */

TEXT keyval[256];

COUNT idxno = (COUNT)ctdbGetIdxnoByNumber(hTable, 0);

if (FirstKey(idxno, 0), keyval)

printf("FirstKey failed\n");

SEE ALSO

ctdbSwitchInstance(), ctdbSwitchContext(), ctdbGetDatno(), ctdbGetIdxno(), ctdbGetIdxnoByName(), ctdbGetError()

TOCIndex