12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- //
- // Created by Иван_Архипов on 17.11.2017.
- //
- #ifndef LOTRO_DAT_PATCHER_DATABASE_H
- #define LOTRO_DAT_PATCHER_DATABASE_H
- #include "Common/SQLite/sqlite3.h"
- #include <string>
- #include "yaml-cpp/yaml.h"
- extern "C++"
- {
- namespace LOTRO_DAT
- {
- class BinaryData;
- class SubfileData;
- class Database {
- public:
- Database();
- explicit Database(const std::string &filename);
- ~Database();
- void InitDatabase(const std::string &filename);
- void PushFile(const SubfileData &data);
- SubfileData GetNextFile();
- void RemoveDatabase();
- void ClearDatabase();
- private:
- void ExecSql(const std::string &sql);
- sqlite3* db_;
- sqlite3_stmt* insert_request_;
- sqlite3_stmt* fetch_one_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`";
- };
- }
- }
- #endif
|