From 5c588f89e79e02cba392abe3d00688772321f88b Mon Sep 17 00:00:00 2001 From: Loïc Blot Date: Wed, 15 Apr 2020 08:01:11 +0200 Subject: Verify database connection on interval (#9665) --- src/database/database-sqlite3.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/database/database-sqlite3.h') diff --git a/src/database/database-sqlite3.h b/src/database/database-sqlite3.h index d7202a918..647eddf7a 100644 --- a/src/database/database-sqlite3.h +++ b/src/database/database-sqlite3.h @@ -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); -- cgit v1.2.3