dataprovider.h

Go to the documentation of this file.
00001 /*
00002  *  The Mana World Server
00003  *  Copyright 2004 The Mana World Development Team
00004  *
00005  *  This file is part of The Mana World.
00006  *
00007  *  The Mana World  is free software; you can redistribute  it and/or modify it
00008  *  under the terms of the GNU General  Public License as published by the Free
00009  *  Software Foundation; either version 2 of the License, or any later version.
00010  *
00011  *  The Mana  World is  distributed in  the hope  that it  will be  useful, but
00012  *  WITHOUT ANY WARRANTY; without even  the implied warranty of MERCHANTABILITY
00013  *  or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
00014  *  more details.
00015  *
00016  *  You should  have received a  copy of the  GNU General Public  License along
00017  *  with The Mana  World; if not, write to the  Free Software Foundation, Inc.,
00018  *  59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
00019  *
00020  *  $Id: dataprovider.h 2475 2006-07-27 17:20:22Z gmelquio $
00021  */
00022 
00023 
00024 #ifndef _TMWSERV_DATA_PROVIDER_H_
00025 #define _TMWSERV_DATA_PROVIDER_H_
00026 
00027 
00028 #include <string>
00029 
00030 #include "recordset.h"
00031 
00032 namespace dal
00033 {
00034 
00038 typedef enum {
00039     DB_BKEND_MYSQL,
00040     DB_BKEND_SQLITE,
00041     DB_BKEND_POSTGRESQL
00042 } DbBackends;
00043 
00044 
00058 class DataProvider
00059 {
00060     public:
00064         DataProvider(void)
00065             throw();
00066 
00067 
00071         virtual
00072         ~DataProvider(void)
00073             throw();
00074 
00075 
00081         bool
00082         isConnected(void) const
00083             throw();
00084 
00085 
00091         virtual DbBackends
00092         getDbBackend(void) const
00093             throw() = 0;
00094 
00095 
00105         virtual void
00106         connect(const std::string& dbName,
00107                 const std::string& userName,
00108                 const std::string& password) = 0;
00109 
00110 
00122         virtual const RecordSet&
00123         execSql(const std::string& sql,
00124                 const bool refresh = false) = 0;
00125 
00126 
00132         virtual void
00133         disconnect(void) = 0;
00134 
00138         std::string
00139         getDbName(void);
00140 
00141 
00142 
00143     protected:
00144         std::string mDbName;  
00145         bool mIsConnected;    
00146         std::string mSql;     
00147         RecordSet mRecordSet; 
00148 };
00149 
00150 
00151 } // namespace dal
00152 
00153 #endif // _TMWSERV_DATA_PROVIDER_H_

Generated on Fri Mar 30 15:39:16 2007 for TMW Server by  doxygen 1.3.9.1