mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-19 03:45:43 +00:00
1st commit
This commit is contained in:
@@ -20,3 +20,7 @@
|
||||
DatabaseWorkerPool<WorldDatabaseConnection> WorldDatabase;
|
||||
DatabaseWorkerPool<CharacterDatabaseConnection> CharacterDatabase;
|
||||
DatabaseWorkerPool<LoginDatabaseConnection> LoginDatabase;
|
||||
|
||||
#ifdef PLAYERBOTS
|
||||
DatabaseWorkerPool<PlayerbotDatabaseConnection> PlayerbotDatabase;
|
||||
#endif
|
||||
|
||||
@@ -25,6 +25,10 @@
|
||||
#include "Implementation/LoginDatabase.h"
|
||||
#include "Implementation/WorldDatabase.h"
|
||||
|
||||
#ifdef PLAYERBOTS
|
||||
#include "PlayerbotDatabase.h"
|
||||
#endif
|
||||
|
||||
#include "Field.h"
|
||||
#include "PreparedStatement.h"
|
||||
#include "QueryCallback.h"
|
||||
@@ -38,4 +42,9 @@ AC_DATABASE_API extern DatabaseWorkerPool<CharacterDatabaseConnection> Character
|
||||
/// Accessor to the realm/login database
|
||||
AC_DATABASE_API extern DatabaseWorkerPool<LoginDatabaseConnection> LoginDatabase;
|
||||
|
||||
#ifdef PLAYERBOTS
|
||||
/// Accessor to the playerbot database
|
||||
AC_DATABASE_API extern DatabaseWorkerPool<PlayerbotDatabaseConnection> PlayerbotDatabase;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -33,6 +33,10 @@ class CharacterDatabaseConnection;
|
||||
class LoginDatabaseConnection;
|
||||
class WorldDatabaseConnection;
|
||||
|
||||
#ifdef PLAYERBOTS
|
||||
class PlayerbotDatabaseConnection;
|
||||
#endif
|
||||
|
||||
class PreparedStatementBase;
|
||||
|
||||
template<typename T>
|
||||
@@ -42,6 +46,10 @@ using CharacterDatabasePreparedStatement = PreparedStatement<CharacterDatabaseCo
|
||||
using LoginDatabasePreparedStatement = PreparedStatement<LoginDatabaseConnection>;
|
||||
using WorldDatabasePreparedStatement = PreparedStatement<WorldDatabaseConnection>;
|
||||
|
||||
#ifdef PLAYERBOTS
|
||||
using PlayerbotDatabasePreparedStatement = PreparedStatement<PlayerbotDatabaseConnection>;
|
||||
#endif
|
||||
|
||||
class PreparedResultSet;
|
||||
using PreparedQueryResult = std::shared_ptr<PreparedResultSet>;
|
||||
using PreparedQueryResultFuture = std::future<PreparedQueryResult>;
|
||||
@@ -71,6 +79,10 @@ using CharacterDatabaseTransaction = SQLTransaction<CharacterDatabaseConnection>
|
||||
using LoginDatabaseTransaction = SQLTransaction<LoginDatabaseConnection>;
|
||||
using WorldDatabaseTransaction = SQLTransaction<WorldDatabaseConnection>;
|
||||
|
||||
#ifdef PLAYERBOTS
|
||||
using PlayerbotDatabaseTransaction = SQLTransaction<PlayerbotDatabaseConnection>;
|
||||
#endif
|
||||
|
||||
class SQLQueryHolderBase;
|
||||
using QueryResultHolderFuture = std::future<void>;
|
||||
using QueryResultHolderPromise = std::promise<void>;
|
||||
@@ -82,6 +94,10 @@ using CharacterDatabaseQueryHolder = SQLQueryHolder<CharacterDatabaseConnection>
|
||||
using LoginDatabaseQueryHolder = SQLQueryHolder<LoginDatabaseConnection>;
|
||||
using WorldDatabaseQueryHolder = SQLQueryHolder<WorldDatabaseConnection>;
|
||||
|
||||
#ifdef PLAYERBOTS
|
||||
using PlayerbotDatabaseQueryHolder = SQLQueryHolder<PlayerbotDatabaseConnection>;
|
||||
#endif
|
||||
|
||||
class SQLQueryHolderCallback;
|
||||
|
||||
// mysql
|
||||
|
||||
@@ -204,3 +204,8 @@ template AC_DATABASE_API
|
||||
DatabaseLoader& DatabaseLoader::AddDatabase<CharacterDatabaseConnection>(DatabaseWorkerPool<CharacterDatabaseConnection>&, std::string const&);
|
||||
template AC_DATABASE_API
|
||||
DatabaseLoader& DatabaseLoader::AddDatabase<WorldDatabaseConnection>(DatabaseWorkerPool<WorldDatabaseConnection>&, std::string const&);
|
||||
|
||||
#ifdef PLAYERBOTS
|
||||
template AC_DATABASE_API
|
||||
DatabaseLoader& DatabaseLoader::AddDatabase<PlayerbotDatabaseConnection>(DatabaseWorkerPool<PlayerbotDatabaseConnection>&, std::string const&);
|
||||
#endif
|
||||
|
||||
@@ -48,8 +48,13 @@ public:
|
||||
DATABASE_LOGIN = 1,
|
||||
DATABASE_CHARACTER = 2,
|
||||
DATABASE_WORLD = 4,
|
||||
#ifdef PLAYERBOTS
|
||||
DATABASE_PLAYERBOT = 8,
|
||||
|
||||
DATABASE_MASK_ALL = DATABASE_LOGIN | DATABASE_CHARACTER | DATABASE_WORLD | DATABASE_PLAYERBOT
|
||||
#else
|
||||
DATABASE_MASK_ALL = DATABASE_LOGIN | DATABASE_CHARACTER | DATABASE_WORLD
|
||||
#endif
|
||||
};
|
||||
|
||||
[[nodiscard]] uint32 GetUpdateFlags() const
|
||||
@@ -57,6 +62,11 @@ public:
|
||||
return _updateFlags;
|
||||
}
|
||||
|
||||
void SetUpdateFlags(uint32 newUpdateFlags)
|
||||
{
|
||||
_updateFlags |= newUpdateFlags;
|
||||
}
|
||||
|
||||
private:
|
||||
bool OpenDatabases();
|
||||
bool PopulateDatabases();
|
||||
@@ -73,7 +83,7 @@ private:
|
||||
std::string const _logger;
|
||||
std::string_view _modulesList;
|
||||
bool const _autoSetup;
|
||||
uint32 const _updateFlags;
|
||||
uint32 _updateFlags;
|
||||
|
||||
std::queue<Predicate> _open, _populate, _update, _prepare;
|
||||
std::stack<Closer> _close;
|
||||
|
||||
@@ -39,6 +39,10 @@
|
||||
#include <sstream>
|
||||
#endif
|
||||
|
||||
#ifdef PLAYERBOTS
|
||||
#include "PlayerbotDatabase.h"
|
||||
#endif
|
||||
|
||||
#if MARIADB_VERSION_ID >= 100600
|
||||
#define MIN_MYSQL_SERVER_VERSION 100200u
|
||||
#define MIN_MYSQL_CLIENT_VERSION 30203u
|
||||
@@ -530,3 +534,7 @@ void DatabaseWorkerPool<T>::ExecuteOrAppend(SQLTransaction<T>& trans, PreparedSt
|
||||
template class AC_DATABASE_API DatabaseWorkerPool<LoginDatabaseConnection>;
|
||||
template class AC_DATABASE_API DatabaseWorkerPool<WorldDatabaseConnection>;
|
||||
template class AC_DATABASE_API DatabaseWorkerPool<CharacterDatabaseConnection>;
|
||||
|
||||
#ifdef PLAYERBOTS
|
||||
template class AC_DATABASE_API DatabaseWorkerPool<PlayerbotDatabaseConnection>;
|
||||
#endif
|
||||
|
||||
@@ -89,7 +89,7 @@ void LoginDatabaseConnection::DoPrepareStatements()
|
||||
PrepareStatement(LOGIN_UPD_MUTE_TIME_LOGIN, "UPDATE account SET mutetime = ? WHERE id = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(LOGIN_UPD_LAST_IP, "UPDATE account SET last_ip = ? WHERE username = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(LOGIN_UPD_LAST_ATTEMPT_IP, "UPDATE account SET last_attempt_ip = ? WHERE username = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(LOGIN_UPD_ACCOUNT_ONLINE, "UPDATE account SET online = ? WHERE id = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(LOGIN_UPD_ACCOUNT_ONLINE, "UPDATE account SET online = 1 WHERE id = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(LOGIN_UPD_UPTIME_PLAYERS, "UPDATE uptime SET uptime = ?, maxplayers = ? WHERE realmid = ? AND starttime = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(LOGIN_DEL_OLD_LOGS, "DELETE FROM logs WHERE (time + ?) < ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(LOGIN_DEL_ACCOUNT_ACCESS, "DELETE FROM account_access WHERE id = ?", CONNECTION_ASYNC);
|
||||
|
||||
Reference in New Issue
Block a user