![]() |
Shadowrun: Awakened 29 September 2011 - Build 871
|
00001 #ifndef __SRADATA_CONNECTIONFACTORY_H 00002 #define __SRADATA_CONNECTIONFACTORY_H 00003 00004 #include <stdlib.h> 00005 #include <iostream> 00006 00007 #include <cppconn/driver.h> 00008 00009 #include "ObjectPool.h" 00010 #include "Singleton.h" 00011 00012 namespace SraData 00013 { 00018 class DbConnectionFactory : public Singleton<DbConnectionFactory>, ObjectPool<sql::Connection> 00019 { 00020 protected: 00021 sql::Driver* _driver; 00022 00023 std::string _dbName; 00024 std::string _login; 00025 std::string _password; 00026 std::string _schema; 00027 00028 sql::Connection* createInstance(); 00029 00030 public: 00031 DbConnectionFactory(const std::string& dbName, const std::string& login, const std::string& password, const std::string& schema); 00032 00033 sql::Connection* getConnection(); 00034 00035 void recycleConnection(sql::Connection* conn); 00036 }; 00037 } 00038 00039 #endif
Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.