ctdbAttachSession
Attaches an already initialized c-tree session to a FairCom DB API session handle.
DECLARATION
CTDBRET ctdbDECL ctdbAttachSession(CTHANDLE Handle, pVOID source, CTATTACH_MODE mode, CTBOOL isTransactionActive);
DESCRIPTION
ctdbAttachSession() attaches an already initialized c-tree ISAM or low-level session to a FairCom DB API session handle. Attached sessions have no information about the server, user name or user password, and these values are set to NULL.
CTATTACH_SESSION - Attach to a FairCom DB API session whose session handle is pointed by the source parameter.
CTATTACH_CTREEID - Attach to a c-tree session whose instance ID string is pointed by the source parameter.
CTATTACH_CURRENT - Attach to the current c-tree instance. Contents of the source parameter is ignored, as the c-tree instance ID is obtained by calling the WCHCTREE() function.
RETURN
Value |
Symbolic Constant |
Explanation |
---|---|---|
0 |
NO_ERROR |
No error occurred. |
See Appendix A for a complete listing of valid c-tree error values.
EXAMPLE
/* logon to c-tree using ISAM function */
INTISAMX(10, 32, 32, 10, (USERPRF_NTKEY | USERPRF_CLRCHK),"admin","ADMIN","FAIRCOMS");
/* attach session to server handle */
if (ctdbAttachSession(hSession,NULL,CTATTACH_CURRENT,FALSE) != CTDBRET_OK)
printf("ctdbAttachSession failed\n");
/*
... do something useful ...
*/
/* detach from session */
if (ctdbDetachSession(hSession) != CTDBRET_OK)
printf("ctdbDetachSession failed\n");
/* perform an ISAM logout */
CLISAM();
SEE ALSO
ctdbDetachSession()