Attach and Detach Existing SessionsThere are situations where an existing connection to c-tree already exists, via a call to a low level or ISAM c-tree initialization function, but c-treeDB functionality is required without terminating the existing connection and starting a new c-treeDB session. The following functions are available to permit a session handle to be attached and detached from an existing c-tree connection. ctdbAttachSession() attaches an inactive session handle to an existing c-tree Plus or c-treeDB session. Attached sessions have no information on server, user name or user password, and these values are set to NULL. If a ctdbLogout() is performed on an attached session handle, no session logout is performed and a ctdbDetachSession() call is executed instead. There are three valid mode values:
ctdbDetachSession() detaches a c-treeDB session handle. The c-tree ISAM or low-level un-initialization is not called, but the session handle control structures are released and re-initialized. Handle is a session handle allocated by ctdbAllocSesison(). ctdbDetachSession() returns CTDBRET_OK on success. Example
INTISAMX(10, 32, 32, 10, (USERPRF_NTKEY | USERPRF_CLRCHK)); /* attach session to server handle */ if (ctdbAttachSession(hSession, NO) != 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(); |
|||||||||||