windows changes
[csql.git] / include / SessionImpl.h
blob9c91d52deb9f0ae42d9c8ad6ee40a31dcb43d4c8
1 /***************************************************************************
2 * Copyright (C) 2007 by www.databasecache.com *
3 * Contact: praba_tuty@databasecache.com *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 ***************************************************************************/
16 #ifndef SESSION_IMPL_H
17 #define SESSION_IMPL_H
18 #include<DatabaseManager.h>
19 #include<UserManager.h>
20 #include<Session.h>
22 class DatabaseManagerImpl;
23 class Database;
25 class DllExport SessionImpl : public Session
27 DatabaseManagerImpl *dbMgr;
28 UserManager *uMgr;
30 char userName[IDENTIFIER_LENGTH];
31 bool isAuthenticated;
32 bool isDba;
33 bool isXTaken;
34 #if (defined MMDB && defined EMBED)
35 static int noOfThreads;
36 #endif
37 public:
38 SessionImpl()
40 dbMgr = NULL; uMgr = NULL;
41 isXTaken = false;
43 ~SessionImpl()
45 close();
47 //This is used by the server process to initialize and create
48 //system and user database->create shared memory segment
49 DbRetVal initSystemDatabase();
50 //Removes the shared memory segment->deletes both the databases
51 DbRetVal destroySystemDatabase();
53 DbRetVal open(const char*username, const char*password);
54 DbRetVal close();
56 DatabaseManager* getDatabaseManager();
57 UserManager* getUserManager();
59 DbRetVal startTransaction(IsolationLevel level);
60 DbRetVal commit();
61 DbRetVal rollback();
62 char * getUserName() { return userName;}
63 DbRetVal readConfigFile();
64 Database* getSystemDatabase();
65 DbRetVal getExclusiveLock();
66 private:
67 #if (defined MMDB && defined EMBED)
68 DbRetVal openEmbeddedConnection(const char *uname, const char *password);
69 DbRetVal closeEmbeddedConnection();
70 #endif
71 DbRetVal authenticate(const char *username, const char *password);
74 #endif