diff options
author | Jude Melton-Houghton <jwmhjwmh@gmail.com> | 2022-01-07 13:28:49 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-07 20:28:49 +0200 |
commit | bf22569019749e421e8ffe0a73cff988a9a9c846 (patch) | |
tree | 9e6910c1faf0ddce191ad4b3110f08b0201fc482 /src/database/database-sqlite3.h | |
parent | b81948a14c138517f6a227dac5b71f0b2facb33c (diff) | |
download | minetest-bf22569019749e421e8ffe0a73cff988a9a9c846.tar.gz minetest-bf22569019749e421e8ffe0a73cff988a9a9c846.tar.bz2 minetest-bf22569019749e421e8ffe0a73cff988a9a9c846.zip |
Use a database for mod storage (#11763)
Diffstat (limited to 'src/database/database-sqlite3.h')
-rw-r--r-- | src/database/database-sqlite3.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/database/database-sqlite3.h b/src/database/database-sqlite3.h index d7202a918..5e3d7c96c 100644 --- a/src/database/database-sqlite3.h +++ b/src/database/database-sqlite3.h @@ -232,3 +232,28 @@ private: sqlite3_stmt *m_stmt_delete_privs = nullptr; sqlite3_stmt *m_stmt_last_insert_rowid = nullptr; }; + +class ModMetadataDatabaseSQLite3 : private Database_SQLite3, public ModMetadataDatabase +{ +public: + ModMetadataDatabaseSQLite3(const std::string &savedir); + virtual ~ModMetadataDatabaseSQLite3(); + + virtual bool getModEntries(const std::string &modname, StringMap *storage); + virtual bool setModEntry(const std::string &modname, + const std::string &key, const std::string &value); + virtual bool removeModEntry(const std::string &modname, const std::string &key); + virtual void listMods(std::vector<std::string> *res); + + virtual void beginSave() { Database_SQLite3::beginSave(); } + virtual void endSave() { Database_SQLite3::endSave(); } + +protected: + virtual void createDatabase(); + virtual void initStatements(); + +private: + sqlite3_stmt *m_stmt_get = nullptr; + sqlite3_stmt *m_stmt_set = nullptr; + sqlite3_stmt *m_stmt_remove = nullptr; +}; |