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:
parent
62c62f3829
commit
5c588f89e7
9 changed files with 65 additions and 33 deletions
|
@ -32,12 +32,13 @@ public:
|
|||
Database_PostgreSQL(const std::string &connect_string);
|
||||
~Database_PostgreSQL();
|
||||
|
||||
virtual void pingDatabase();
|
||||
|
||||
void beginSave();
|
||||
void endSave();
|
||||
|
||||
bool initialized() const;
|
||||
|
||||
|
||||
protected:
|
||||
// Conversion helpers
|
||||
inline int pg_to_int(PGresult *res, int row, int col)
|
||||
|
@ -82,7 +83,6 @@ protected:
|
|||
}
|
||||
|
||||
void createTableIfNotExists(const std::string &table_name, const std::string &definition);
|
||||
void verifyDatabase();
|
||||
|
||||
// Database initialization
|
||||
void connectToDatabase();
|
||||
|
@ -113,6 +113,8 @@ public:
|
|||
MapDatabasePostgreSQL(const std::string &connect_string);
|
||||
virtual ~MapDatabasePostgreSQL() = default;
|
||||
|
||||
virtual void pingDatabase() { Database_PostgreSQL::pingDatabase(); }
|
||||
|
||||
bool saveBlock(const v3s16 &pos, const std::string &data);
|
||||
void loadBlock(const v3s16 &pos, std::string *block);
|
||||
bool deleteBlock(const v3s16 &pos);
|
||||
|
@ -132,6 +134,8 @@ public:
|
|||
PlayerDatabasePostgreSQL(const std::string &connect_string);
|
||||
virtual ~PlayerDatabasePostgreSQL() = default;
|
||||
|
||||
virtual void pingDatabase() { Database_PostgreSQL::pingDatabase(); }
|
||||
|
||||
void savePlayer(RemotePlayer *player);
|
||||
bool loadPlayer(RemotePlayer *player, PlayerSAO *sao);
|
||||
bool removePlayer(const std::string &name);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue