Product Documentation

c-treeDB API API for C

Previous Topic

Next Topic

ctdbGetIdxnoByName

Retrieve the index file number from a table handle.

Declaration

NINT ctdbGetIdxnoByName(CTHANDLE Handle, pTEXT indexname)

Description

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

  • Handle is a table handle.
  • indexname is a string containing the index name.

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

Return

Value

Symbolic Constant

Explanation

-1

N/A

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

See Appendix A "c-tree Plus Error Codes" in c-tree Plus Programmer's Reference Guide 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)ctdbGetIdxnoByName(hTable, "indexname");

if (FirstKey(idxno, 0), keyval)

printf("FirstKey failed\n");

See also

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

TOCIndex