mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-12-22 21:43:35 +00:00
a60865cd19
* simplify leaderboard code, fully abstract database * update exception catching * update exception catching and sql references, remove ugc from gamemessages fix deleting model remove unrelated changes Update GameMessages.cpp * remove ugc from gamemessages * Update GameMessages.cpp * Update Leaderboard.cpp * bug fixes * fix racing leaderboard * remove extra stuff * update * add sqlite * use a default for optimizations * update sqlite * Fix limits on update and delete * fix bugs * use definition to switch between databases * add switch for different backends * fix include guard and includes * always build both * add mysql if block * Update Database.cpp * add new options and add check to prevent overriding mysql * correct config names * Update README.md * Update README.md * merge to 1 sql file for sqlite database * move to sqlite folder * add back mysql migrations * Update README.md * add migration to correct the folder name or mysql * yes aron * updates * Update CMakeLists.txt * dont use paths at all, add where check to only update if folder name still exist check also doesnt check for slashes and assumes one will be there since it will be. * default dont auto create account for releases we can change this flag * default 0 * add times played query * fix leaderboard not incrementing on a not better score * add env vars with defaults for docker * use an "enum" * default to mariadb * Update .env.example
55 lines
1.7 KiB
C++
55 lines
1.7 KiB
C++
#ifndef __GAMEDATABASE__H__
|
|
#define __GAMEDATABASE__H__
|
|
|
|
#include <optional>
|
|
|
|
#include "ILeaderboard.h"
|
|
#include "IPlayerCheatDetections.h"
|
|
#include "ICommandLog.h"
|
|
#include "IMail.h"
|
|
#include "IObjectIdTracker.h"
|
|
#include "IPlayKeys.h"
|
|
#include "IServers.h"
|
|
#include "IBugReports.h"
|
|
#include "IPropertyContents.h"
|
|
#include "IProperty.h"
|
|
#include "IPetNames.h"
|
|
#include "ICharXml.h"
|
|
#include "IMigrationHistory.h"
|
|
#include "IUgc.h"
|
|
#include "IFriends.h"
|
|
#include "ICharInfo.h"
|
|
#include "IAccounts.h"
|
|
#include "IActivityLog.h"
|
|
#include "IIgnoreList.h"
|
|
#include "IAccountsRewardCodes.h"
|
|
#include "IBehaviors.h"
|
|
#include "IUgcModularBuild.h"
|
|
|
|
#ifdef _DEBUG
|
|
# define DLU_SQL_TRY_CATCH_RETHROW(x) do { try { x; } catch (std::exception& ex) { LOG("SQL Error: %s", ex.what()); throw; } } while(0)
|
|
#else
|
|
# define DLU_SQL_TRY_CATCH_RETHROW(x) x
|
|
#endif // _DEBUG
|
|
|
|
class GameDatabase :
|
|
public IPlayKeys, public ILeaderboard, public IObjectIdTracker, public IServers,
|
|
public IMail, public ICommandLog, public IPlayerCheatDetections, public IBugReports,
|
|
public IPropertyContents, public IProperty, public IPetNames, public ICharXml,
|
|
public IMigrationHistory, public IUgc, public IFriends, public ICharInfo,
|
|
public IAccounts, public IActivityLog, public IAccountsRewardCodes, public IIgnoreList,
|
|
public IBehaviors, public IUgcModularBuild {
|
|
public:
|
|
virtual ~GameDatabase() = default;
|
|
// TODO: These should be made private.
|
|
virtual void Connect() = 0;
|
|
virtual void Destroy(std::string source = "") = 0;
|
|
virtual void ExecuteCustomQuery(const std::string_view query) = 0;
|
|
virtual void Commit() = 0;
|
|
virtual bool GetAutoCommit() = 0;
|
|
virtual void SetAutoCommit(bool value) = 0;
|
|
virtual void DeleteCharacter(const uint32_t characterId) = 0;
|
|
};
|
|
|
|
#endif //!__GAMEDATABASE__H__
|