include/Session.h

Go to the documentation of this file.
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_H
00017 #define SESSION_H
00018 #include<DatabaseManager.h>
00019 #include<UserManager.h>
00020 #include<ErrorType.h>
00021 class Session;
00026 enum IsolationLevel
00027 {
00028     READ_UNCOMMITTED = 1,
00029     READ_COMMITTED = 2,
00030     READ_REPEATABLE = 3,
00031     WRITE_OSYNC = 4 //this will work only from sqlapi
00032                     //for dbapi WRITE_OSYNC = READ_REPEATABLE
00033 };
00034 
00061 class Connection
00062 {
00063     Session *session;
00064     public:
00065     Connection() { session = NULL; }
00066     ~Connection(); 
00067 
00073     DbRetVal open(const char*username, const char*password);
00074 
00075 
00079     DbRetVal close();
00080 
00084     DatabaseManager* getDatabaseManager();
00085 
00089     UserManager* getUserManager();
00090 
00098     DbRetVal startTransaction(IsolationLevel level = READ_COMMITTED);
00099 
00107     DbRetVal commit();
00108 
00116     DbRetVal rollback();
00117 };
00118 
00119 
00120 class Session
00121 {
00122     public:
00123     virtual DbRetVal open(const char*username, const char*password)=0;
00124     virtual DbRetVal close()=0;
00125 
00126     virtual DatabaseManager* getDatabaseManager()=0;
00127     virtual UserManager* getUserManager()=0;
00128 
00129     virtual DbRetVal startTransaction(IsolationLevel level)=0;
00130     virtual DbRetVal commit()=0;
00131     virtual DbRetVal rollback()=0;
00132     //TODO:: virtual int setAutoCommit(bool flag)=0;
00133     //TODO::support for save points
00134     virtual ~Session() { }
00135 
00136 };
00137 
00138 
00139 
00140 #endif

Generated on Mon Jun 9 22:37:14 2008 for csql by  doxygen 1.4.7