// // Created by Иван_Архипов on 17.11.2017. // #ifndef LOTRO_DAT_PATCHER_DATABASE_H #define LOTRO_DAT_PATCHER_DATABASE_H #include "Common/SQLite/sqlite3.h" #include extern "C++" { namespace LOTRO_DAT { class BinaryData; class Database { public: Database(); explicit Database(const std::string &filename); ~Database(); void InitDatabase(const std::string &filename); void PushFile(const BinaryData &binary_data, const std::u16string &text_data, const std::string &options); void GetFile(); void GetFile(long long file_id); private: void ExecSql(const std::string &sql); sqlite3* db_; sqlite3_stmt* insert_request_; sqlite3_stmt* get_text_; sqlite3_stmt* get_binary_; const std::string CreateTableCommand_ = "CREATE TABLE IF NOT EXISTS `patch_data` ( " "`binary_data` BLOB, " "`text_data` TEXT, " "`options` TEXT NOT NULL);"; const std::string InsertFileCommand_ = "INSERT INTO patch_data " "(binary_data, text_data, options) " "VALUES (?, ?, ?); "; }; } } #endif