123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- #ifndef LOTRO_DAT_DATABASE_H
- #define LOTRO_DAT_DATABASE_H
- #include <string>
- struct sqlite3;
- struct sqlite3_stmt;
- 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`";
- };
- } // namespace LOTRO_DAT
- } // extern "C++"
- #endif
|