ctdbSwitchContext
Force an ISAM context switch.
Declaration
CTDBRET ctdbSwitchContext(CTHANDLE Handle)
Description
Force a switch to the FairCom DB ISAM context indicated by the record handle. Each record handle has its own c-tree ISAM context id.
When most c-treeDB API record handling functions are called, they automatically perform a c-tree ISAM context switch. ctdbSwitchContext() may be useful before calling specific c-tree ISAM or low level calls to make sure the correct ISAM context is active before making those calls.
Handle is a record handle. The handle must be a record handle. No other type of c-treeDB API handle is acceptable.
Return
Value |
Symbolic Constant |
Explanation |
---|---|---|
0 |
CTDBRET_OK |
Successful function. |
See Appendix A "c-tree Plus Error Codes" in c-tree Plus Programmer's Reference Guide for a complete listing of valid c-tree Plus error values.
Example
/* force a context switch */
if (ctdbSwitchContext(hRecord) != CTDBRET_OK)
printf("ctdbSwitchContext failed\n");
/* call ResetRecord */
if (ResetRecord((COUNT)ctdbGetDatno(hRecord), SWTCURI))
printf("ResetRecord failed\n");
See also
ctdbSwitchInstance(), ctdbGetDatno(), ctdbGetIdxno(), ctdbGetIdxnoByName(), ctdbGetIdxnoByNumber()