mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-10 03:53:26 -08:00
[Server] Create the main database interface through a virtual factory (#7861)
This commit is contained in:
parent
c4ac80e282
commit
3a1238a467
2 changed files with 12 additions and 1 deletions
|
|
@ -314,6 +314,11 @@ static std::optional<ServerInfo_RoomChannel::AccessLevel> roomChannelAccessFromK
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Server_DatabaseInterface *Servatrice::createMainDatabaseInterface()
|
||||||
|
{
|
||||||
|
return new Servatrice_DatabaseInterface(-1, this);
|
||||||
|
}
|
||||||
|
|
||||||
bool Servatrice::initServer()
|
bool Servatrice::initServer()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
@ -397,7 +402,11 @@ bool Servatrice::initServer()
|
||||||
} else {
|
} else {
|
||||||
databaseType = DatabaseNone;
|
databaseType = DatabaseNone;
|
||||||
}
|
}
|
||||||
servatriceDatabaseInterface = new Servatrice_DatabaseInterface(-1, this);
|
servatriceDatabaseInterface = createMainDatabaseInterface();
|
||||||
|
if (!servatriceDatabaseInterface) {
|
||||||
|
qCCritical(ServatriceLog) << "Failed to create the database interface; refusing to start.";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
setDatabaseInterface(servatriceDatabaseInterface);
|
setDatabaseInterface(servatriceDatabaseInterface);
|
||||||
|
|
||||||
if (databaseType != DatabaseNone) {
|
if (databaseType != DatabaseNone) {
|
||||||
|
|
|
||||||
|
|
@ -163,6 +163,8 @@ private slots:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void doSendIslMessage(const IslMessage &msg, int _serverId) override;
|
void doSendIslMessage(const IslMessage &msg, int _serverId) override;
|
||||||
|
/** @brief Creates the database interface the server itself runs on; the shipped server uses MySQL. */
|
||||||
|
virtual Server_DatabaseInterface *createMainDatabaseInterface();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum DatabaseType
|
enum DatabaseType
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue