Product Documentation

FairCom DB API for C

Previous Topic

Next Topic

Working with Sessions without Dictionary Support

There are situations where it is necessary to operate with a table that does not belong to a database, or where a session or database dictionary file is not required. For these situations the user may want to allocate a session handle of type CTSESSION_CTREE.

CTSESSION hSession;

hSession = ctdbAllocSession(CTSESSION_CTREE);

if (!hSession)

FatalError("Session handle allocation failed\n");

if (ctdbLogon(hSession, "FAIRCOMS", "ADMIN", "ADMIN") != CTDBRET_OK)

FatalError("Session logon failed\n");

The ctdbLogon() call above performs a c-tree logon but it will not attempt to open a session dictionary file. The same result is obtained by allocating a CTSESSION_CTDB or CTSESSION_SQL session but calling ctdbSetLogonOnly() before ctdbLogon().

CTSESSION hSession;

hSession = ctdbAllocSession(CTSESSION_CTDB);

if (!hSession)

FatalError("Session handle allocation failed\n");

ctdbSetLogonOnly(hSession, YES);

if (ctdbLogon(hSession, "FAIRCOMS", "ADMIN", "ADMIN") != CTDBRET_OK)

FatalError("Session logon failed\n");

TOCIndex