2 #ifndef comfrm_DatabaseManagerH
3 #define comfrm_DatabaseManagerH
40 #include <boost/function.hpp>
41 #include <boost/shared_ptr.hpp>
42 #include <boost/asio.hpp>
71 DatabaseManager(
const std::string& defaultDD, std::unique_ptr<DatabaseAccess> defaultDbAccess,
72 const std::string& user,
const std::string& psw, boost::asio::io_service& ioservice);
76 void requestTable(
const std::string& table,
OnTableReceivedClb clb,
bool isCached =
false);
80 void executeSqlRequest(
const std::string& request,
OnTableReceivedClb clb,
const std::string& db =
"");
83 std::shared_ptr<com::sql::SqlTable> getTable(
const std::string& table);
89 void addDatabase(
const std::string& dd, std::unique_ptr<DatabaseAccess> dbAccess);
92 void setDefaultAuth(
const std::string& user,
const std::string& psw);
95 virtual void processReceivedTable(std::shared_ptr<com::sql::SqlTable> table);
97 std::shared_ptr<com::sql::SqlTable> table);
98 std::tuple<std::string, std::string, std::string> parseTableName(
const std::string& table);
99 std::string getFullTableName(
const std::string& table);
103 std::shared_ptr<com::sql::SqlTable> table);
105 std::map< std::string, std::unique_ptr<DatabaseAccess> > m_databases;
106 std::map< std::string, std::shared_ptr<com::sql::SqlTable> > m_cachedTables;
107 boost::asio::io_service& m_ioservice;
108 std::string m_defaultUser;
109 std::string m_defaultPassword;
110 std::string m_defaultDD;
std::function< void(bool) > OnCacheReadyClb
Тип коллбэка на готовность кэширования
Definition: database_manager.h:63
Интерфейс менеджера баз данных
Definition: database_manager.h:56
std::function< void(std::shared_ptr< com::sql::SqlTable >) > OnTableReceivedClb
Тип коллбэка на получение таблицы
Definition: database_manager.h:60