Product Documentation

c-treeDB API API for C

Previous Topic

Next Topic

ctdbGetDatno

Retrieve the table data file number.

DECLARATION

NINT ctdbGetDatno(CTHANDLE Handle)

DESCRIPTION

Retrieves the table data file number.

  • Handle must be a table handle, or a handle that can be converted into a table handle such as a record, segment, index or field handle.

Return the table datno on success or -1 on failure. If ctdbGetDatno() returns -1, the error code can be retrieved by calling the ctdbGetError() function.

RETURN

Value

Symbolic Constant

Explanation

0

NO_ERROR

No error occurred.

-1

 

ctdbGetDatno() 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

CTDBRET DeleteTable(CTHANDLE hSession, pTEXT tablename)

{

CTDBRET Retval = CTDBRET_OK;

CTHANDLE hTable = ctdbAllocTable(hSession);

if (hTable)

{

/* open the table exclusive */

if ((Retval = ctdbOpenTable(hTable, tablename, CTOPEN_EXCLUSIVE)) != CTDBRET_OK)

return Retval;

/* delete a file */

if ((Retval = (CTDBRET)DeleteRFile((COUNT)ctdbGetDatno(hTable)) != CTDBRET_OK)

return Retval;

}

else

Retval = CTDBRET_NOMEMORY;

return Retval;

}

SEE ALSO

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

TOCIndex