Product Documentation

c-treeDB API API for C

Previous Topic

Next Topic

ctdbAllocDatabase

Allocate and initialize a new database handle.

Declaration

CTHANDLE ctdbAllocDatabase(CTHANDLE Handle)

Description

ctdbAllocDatabase() allocates memory and initializes a new database handle and associates the handle with the session specified by Handle. Before any operations on a database can take place, the application must allocate a database handle.

  • Handle [in] - the session handle.

The next step in operating on a database is to connect the database handle returned by this function to the desired database (which has been previously added to the session specified by Handle) by calling ctdbConnect(). The database handle is released by calling ctdbFreeDatabase(). Do not release the database handle by calling the C runtime library function free().

Returns

ctdbAllocDatabase returns the database handle on success or NULL on failure.

Example


CTHANDLE hDatabase = ctdbAllocDatabase(hSession);

See also

ctdbFreeDatabase(), ctdbAllocSession(), ctdbAllocTable()

TOCIndex