Product Documentation

c-treeDB API for C++ - Developers Guide

Previous Topic

Next Topic

Working with Sessions without Dictionary Support

There may be 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 create a session object of type CTSESSION_CTREE.

// create a session object without dictionary support

CTSession ASession(CTSESSION_CTREE);

// Logon to a session

try

{

ASession.Logon("FAIRCOMS", "ADMIN", "ADMIN");

}

catch (CTException &err)

{

printf("Session logon failed with code %d\n", err.GetErrorCode());

}

The CTSession::Logon() call above will perform a c-tree logon but it will not attempt to open a session dictionary file. The same result is obtained if a normal CTSESSION_CTDB or CTSESSION_SQL session is allocated but the method CTSession::SetLogonOnly() is called before CTSession::Logon().

// create a session object without dictionary support

CTSession ASession;

// Logon to a session

try

{

ASession.SetLogonOnly();

ASession.Logon("FAIRCOMS", "ADMIN", "ADMIN");

}

catch (CTException &err)

{

printf("Session logon failed with code %d\n", err.GetErrorCode());

}

TOCIndex