Creating a Session objectA valid session object is required to perform any session operation. The default parameter of the CTSession constructor is CTSESSION_CTDB. // create a default CTSession object CTSession ASession; try {
// logon to session using default // server name, user name and password. CTSession.Logon(); } catch (CTException &err) {
printf(“Session logon failed with error %d\n”, err.GetErrorCode); } If you create a dynamic CTSession object with the new operator, you are required to destroy the object with the delete operator. // create a dynamic CTSession object CTSession* pSession = new CTSession; if (!pSession) {
printf(“CTSession allocation failed\n”); } ... other operations .. // destroy the CTSession object delete pSession; When a session object is created, we can specify the session type. There are three different session types:
// Create a session object CTSession ASession(CTSESSION_CTDB); |
|||||||||