Product Documentation

c-treeDB API API for C

Previous Topic

Next Topic

CTDB_ON_SESSION_LOGON

A CTDB_ON_SESSION_LOGON callback is invoked after a successful session logon but before the ctdbLogon() function returns. The handle passed as a parameter with this callback is a session handle. You can safely typecast the handle parameter to a pCTDBSESSION structure pointer.

The session logon callback can be used as an indication that the session is now active and that database and table processing may occur. This callback is a good place to set session-wide parameters that may be active until a session logout is performed.

c-treeDB API C API Example


CTDBRET ctdbDECL OnSessionLogon(CTHANDLE Handle)

{

CTDBRET Retval = CTDBRET_OK;

pCTDBSESSION pSession = (pCTDBSESSION)Handle;

if (!pSession)

Retval = CTDBRET_NOTSESSION;

else

{

/* allocate 100 bytes of memory and keep it in the session local tag */

pSession->localTag = pSession->OnAlloc(100);

if (!pSession->localTag)

Retval = CTDBRET_NOMEMORY;

}

return Retval;

}

TOCIndex