Product Documentation

c-treeDB API API for C

Previous Topic

Next Topic

ctdbOpenTable

Open an existing table given its name.

Declaration

CTDBRET ctdbOpenTable(CTHANDLE Handle, pTEXT TableName,

CTOPEN_MODE OpenMode)

Description

ctdbOpenTable() opens an existing table, given its name. The database that contains the table was specified previously, when table handle Handle was allocated. c-treeDB API will look for the table and index files in the server directory (client/server applications) or in the execution directory (standalone applications).

To override this default directory, specify your own directory with ctdbSetTablePath() before you call this function.

To open a table that is protected with a password, call ctdbSetTablePassword() with Handle before you call this function.

To open an existing table given its unique identifier, use ctdbOpenTableByUID(). To create a table, use ctdbCreateTable(). To retrieve the table open mode, use ctdbGetTableOpenMode(). To close an open table, use ctdbCloseTable().

  • Handle [in] the Table Handle, previously allocated and associated with a database by calling ctdbAllocTable().
  • TableName [in] the table name.
  • OpenMode [in] the table open mode. The valid values for the table open mode are listed in c-treeDB API definitions.

To open an existing mirrored table, use ctdbOpenTable() specifying the proper mirror naming convention:

if (ctdbOpenTable(hTable, "customer|mirror", CTOPEN_NORMAL))

printf("ctdbOpenTable failed\n");

Returns

ctdbOpenTable() returns CTDBRET_OK on success, or c-treeDB API error on failure.

See also

ctdbAllocTable(), ctdbCreateTable(), ctdbGetTableOpenMode(), ctdbCloseTable(), ctdbOpenTableByUID()

TOCIndex