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: dalstorage.hpp 3167 2007-03-05 03:32:59Z rogier_polak $ 00021 */ 00022 00023 00024 #ifndef _TMWSERV_DALSTORAGE_H_ 00025 #define _TMWSERV_DALSTORAGE_H_ 00026 00027 #include "account-server/characterdata.hpp" 00028 #include "account-server/storage.hpp" 00029 #include "dal/dataprovider.h" 00030 00038 class DALStorage: public Storage 00039 { 00040 // friend so that Storage can call the constructor. 00041 friend class Storage; 00042 00043 00044 public: 00048 void 00049 open(void); 00050 00051 00055 void 00056 close(void); 00057 00058 00066 AccountPtr 00067 getAccount(const std::string& userName); 00068 00076 AccountPtr 00077 getAccountByID(int accountID); 00078 00086 CharacterPtr getCharacter(int id); 00087 00093 void 00094 addAccount(const AccountPtr& account); 00095 00096 00102 void delAccount(AccountPtr const &account); 00103 00109 void unloadAccount(AccountPtr const &account); 00110 00115 std::list<std::string> 00116 getEmailList(); 00117 00122 bool doesEmailAddressExist(std::string const &email); 00123 00128 bool doesCharacterNameExist(std::string const &name); 00129 00137 bool 00138 updateCharacter(CharacterPtr ptr); 00139 00144 std::map<short, ChatChannel> 00145 getChannelList(); 00146 00151 void 00152 updateChannels(std::map<short, ChatChannel>& channelList); 00153 00159 void flushAll(); 00160 void flush(AccountPtr const &); 00161 00162 private: 00166 DALStorage(void); 00167 00168 00172 ~DALStorage(void) 00173 throw(); 00174 00175 00179 DALStorage(const DALStorage& rhs); 00180 00181 00185 DALStorage& 00186 operator=(const DALStorage& rhs); 00187 00188 00197 void 00198 createTable(const std::string& tblName, 00199 const std::string& sql); 00200 00201 00202 private: 00203 std::auto_ptr<dal::DataProvider> mDb; 00204 }; 00205 00206 #endif // _TMWSERV_DALSTORAGE_H_
1.3.9.1