00001 /*************************************************************************** 00002 * Copyright (C) 2007 by www.databasecache.com * 00003 * Contact: praba_tuty@databasecache.com * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 ***************************************************************************/ 00016 #ifndef SESSION_IMPL_H 00017 #define SESSION_IMPL_H 00018 #include<DatabaseManager.h> 00019 #include<UserManager.h> 00020 #include<Session.h> 00021 00022 class DatabaseManagerImpl; 00023 class Database; 00024 00025 class SessionImpl : public Session 00026 { 00027 DatabaseManagerImpl *dbMgr; 00028 UserManager *uMgr; 00029 00030 char userName[IDENTIFIER_LENGTH]; 00031 bool isAuthenticated; 00032 bool isDba; 00033 00034 public: 00035 SessionImpl() 00036 { 00037 dbMgr = NULL; uMgr = NULL; 00038 } 00039 ~SessionImpl() 00040 { 00041 close(); 00042 } 00043 //This is used by the server process to initialize and create 00044 //system and user database->create shared memory segment 00045 DbRetVal initSystemDatabase(); 00046 //Removes the shared memory segment->deletes both the databases 00047 DbRetVal destroySystemDatabase(); 00048 00049 DbRetVal open(const char*username, const char*password); 00050 DbRetVal close(); 00051 00052 DatabaseManager* getDatabaseManager(); 00053 UserManager* getUserManager(); 00054 00055 DbRetVal startTransaction(IsolationLevel level); 00056 DbRetVal commit(); 00057 DbRetVal rollback(); 00058 00059 DbRetVal readConfigFile(); 00060 Database* getSystemDatabase(); 00061 private: 00062 DbRetVal authenticate(const char *username, const char *password); 00063 }; 00064 00065 #endif