1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-02 16:38:41 +00:00

Verify database connection on interval (#9665)

This commit is contained in:
Loïc Blot 2020-04-15 08:01:11 +02:00 committed by GitHub
parent 62c62f3829
commit 5c588f89e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 65 additions and 33 deletions

View file

@ -36,13 +36,13 @@ public:
void beginSave();
void endSave();
// Open and initialize the database if needed
virtual void pingDatabase();
bool initialized() const { return m_initialized; }
protected:
Database_SQLite3(const std::string &savedir, const std::string &dbname);
// Open and initialize the database if needed
void verifyDatabase();
// Convertors
inline void str_to_sqlite(sqlite3_stmt *s, int iCol, const std::string &str) const
{
@ -146,6 +146,8 @@ public:
MapDatabaseSQLite3(const std::string &savedir);
virtual ~MapDatabaseSQLite3();
virtual void pingDatabase() { Database_SQLite3::pingDatabase(); }
bool saveBlock(const v3s16 &pos, const std::string &data);
void loadBlock(const v3s16 &pos, std::string *block);
bool deleteBlock(const v3s16 &pos);
@ -173,6 +175,8 @@ public:
PlayerDatabaseSQLite3(const std::string &savedir);
virtual ~PlayerDatabaseSQLite3();
virtual void pingDatabase() { Database_SQLite3::pingDatabase(); }
void savePlayer(RemotePlayer *player);
bool loadPlayer(RemotePlayer *player, PlayerSAO *sao);
bool removePlayer(const std::string &name);
@ -208,6 +212,8 @@ public:
AuthDatabaseSQLite3(const std::string &savedir);
virtual ~AuthDatabaseSQLite3();
virtual void pingDatabase() { Database_SQLite3::pingDatabase(); }
virtual bool getAuth(const std::string &name, AuthEntry &res);
virtual bool saveAuth(const AuthEntry &authEntry);
virtual bool createAuth(AuthEntry &authEntry);