Product Documentation

c-treeDB API API for C

Previous Topic

Next Topic

ctdbGetCallback

Retrieves the callback function pointer associate with the callback type.

DECLARATION

ctdbCallbackFunction ctdbGetCallback(CTHANDLE Handle, CTDB_CALLBACK_TYPE CallBackType)

DESCRIPTION

  • Handle is a valid c-treeDB API session, database, table or record handle.
  • CallBackType is one of the valid callback types.

You can check if a given callback has been registered with a session, database, table or record handle by calling the ctdbGetCallback() function. If a callback function was set, ctdbGetCallback() returns the address of the function. If a particular callback is not set, ctdbGetCallback() returns NULL.

RETURN

Returns the function pointer, or NULL if the callback was not registered.

EXAMPLE

/* allocate a table handle */

CTHANDLE hTable = ctdbAllocTable(hDatabase);


/* make sure CTDB_ON_TABLE_OPEN callback is set */

if (ctdbGetCallback(hTable, CTDB_ON_TABLE_OPEN) == NULL)

if (ctdbSetCallback(hTable, CTDB_ON_TABLE_OPEN, OnTableOpen) != CTDBRET_OK)

printf("ctdbSetCallback failed\n");

SEE ALSO

ctdbClearAllCallback(), ctdbClearCallback(), ctdbSetCallback()

TOCIndex