123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- //
- // Created by Иван_Архипов on 17.11.2017.
- //
- #ifndef LOTRO_DAT_PATCHER_DATABASE_H
- #define LOTRO_DAT_PATCHER_DATABASE_H
- #include <SQLite/sqlite3.h>
- #include <string>
- #include <yaml-cpp/yaml.h>
- extern "C++"
- {
- namespace LOTRO_DAT
- {
- class BinaryData;
- class SubfileData;
- class Database {
- public:
- Database();
- ~Database();
- bool InitDatabase(const std::string &filename);
- bool CloseDatabase();
- bool PushFile(const SubfileData &data);
- SubfileData GetNextFile();
- bool RemoveDatabase();
- bool ClearDatabase();
- size_t CountRows();
- private:
- void ExecSql(const std::string &sql);
- sqlite3* db_;
- sqlite3_stmt* insert_request_;
- sqlite3_stmt* fetch_one_request_;
- sqlite3_stmt* get_rows_number_request_;
- 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 (?, ?, ?); ";
- const std::string FetchOneCommand = "SELECT * FROM `patch_data`";
- const std::string ClearTableCommand_ = "DELETE * FROM `patch_data`";
- const std::string GetRowsNumberCommand_ = "SELECT Count(*) as count FROM `patch_data`";
- };
- }
- }
- #endif
|