// Copyright: All Rights Reserved // Author: egametang@gmail.com (tanghai) #ifndef ORM_SQLHELPER_H #define ORM_SQLHELPER_H #include #include #include #include #include #include "Orm/DbResult.h" #include "Orm/Typedef.h" #include "Orm/Select.h" namespace Egametang { class DbHelper { private: std::unique_ptr connection; std::unique_ptr statement; public: DbHelper(std::string url, std::string username, std::string password); virtual ~DbHelper(); template DbResultPtr Execute(Select select) { std::string sql = select.ToString(); ResultSetPtr resultSet(statement->executeQuery(sql)); auto dbResult = boost::make_shared(resultSet); return dbResult; } }; } // namespace Egametang #endif // ORM_SQLHELPER_H