Product Documentation

c-treeDB API for C++ - Developers Guide

Previous Topic

Next Topic

CTBase::SwitchInstance

Force a c-tree instance switch.

Declaration

void CTBase::SwitchInstance()

Description

Force a switch to the c-tree Plus instance indicated by the current session object. Each session object has its unique c-tree instance id.

When most c-treeDB C++ methods are called, they automatically perform a c-tree instance switch. SwitchInstance() may be useful before calling specific c-tree ISAM or low level functions to make sure the correct instance is active before making those calls.

Return

If any errors are detected, a CTException is thrown

See "c-treeDB Errors and Return Values" for a complete listing of valid c-treeDB error codes and return values.

Example


// declare a remote and local session objects

CTSession hRemove(CTSESSION_CTREE);

CTSession hLocal(CTSESSION_CTREE);


// logon to c-tree server using the remote session object

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


// logon to local session using the local session object

hLocal.Logon("local", "ADMIN", "ADMIN);


// perform a c-tree instance switch and call //CtreeUserOperation function

hRemote.SwitchInstance();

CtreeUserOperation("!mkdir faircom", buffer, sizeof(buffer));


See also

CTRecord::SwitchContext(), CTTable::GetDatno(), CTTable::GetIdxno(), CTIndex::GetIdxno()

TOCIndex