mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-16 10:30:27 +00:00
feat(Core/Database): port TrinityCore database API (#5611)
This commit is contained in:
@@ -319,8 +319,9 @@ public:
|
||||
else
|
||||
targetGuid = target->GetGUID();
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_BANINFO);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_BANINFO);
|
||||
stmt->setUInt32(0, targetGuid.GetCounter());
|
||||
|
||||
PreparedQueryResult result = CharacterDatabase.Query(stmt);
|
||||
if (!result)
|
||||
{
|
||||
@@ -378,7 +379,7 @@ public:
|
||||
|
||||
static bool HandleBanListAccountCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_EXPIRED_IP_BANS);
|
||||
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_EXPIRED_IP_BANS);
|
||||
LoginDatabase.Execute(stmt);
|
||||
|
||||
char* filterStr = strtok((char*)args, " ");
|
||||
@@ -388,12 +389,12 @@ public:
|
||||
|
||||
if (filter.empty())
|
||||
{
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BANNED_ALL);
|
||||
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BANNED_ALL);
|
||||
result = LoginDatabase.Query(stmt);
|
||||
}
|
||||
else
|
||||
{
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BANNED_BY_USERNAME);
|
||||
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BANNED_BY_USERNAME);
|
||||
stmt->setString(0, filter);
|
||||
result = LoginDatabase.Query(stmt);
|
||||
}
|
||||
@@ -495,7 +496,7 @@ public:
|
||||
return false;
|
||||
|
||||
std::string filter(filterStr);
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUID_BY_NAME_FILTER);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUID_BY_NAME_FILTER);
|
||||
stmt->setString(0, filter);
|
||||
PreparedQueryResult result = CharacterDatabase.Query(stmt);
|
||||
if (!result)
|
||||
@@ -512,8 +513,9 @@ public:
|
||||
do
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
PreparedStatement* stmt2 = CharacterDatabase.GetPreparedStatement(CHAR_SEL_BANNED_NAME);
|
||||
CharacterDatabasePreparedStatement* stmt2 = CharacterDatabase.GetPreparedStatement(CHAR_SEL_BANNED_NAME);
|
||||
stmt2->setUInt32(0, fields[0].GetUInt32());
|
||||
|
||||
PreparedQueryResult banResult = CharacterDatabase.Query(stmt2);
|
||||
if (banResult)
|
||||
handler->PSendSysMessage("%s", (*banResult)[0].GetCString());
|
||||
@@ -533,8 +535,9 @@ public:
|
||||
|
||||
std::string char_name = fields[1].GetString();
|
||||
|
||||
PreparedStatement* stmt2 = CharacterDatabase.GetPreparedStatement(CHAR_SEL_BANINFO_LIST);
|
||||
CharacterDatabasePreparedStatement* stmt2 = CharacterDatabase.GetPreparedStatement(CHAR_SEL_BANINFO_LIST);
|
||||
stmt2->setUInt32(0, fields[0].GetUInt32());
|
||||
|
||||
PreparedQueryResult banInfo = CharacterDatabase.Query(stmt2);
|
||||
if (banInfo)
|
||||
{
|
||||
@@ -572,7 +575,7 @@ public:
|
||||
|
||||
static bool HandleBanListIPCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_EXPIRED_IP_BANS);
|
||||
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_EXPIRED_IP_BANS);
|
||||
LoginDatabase.Execute(stmt);
|
||||
|
||||
char* filterStr = strtok((char*)args, " ");
|
||||
@@ -583,12 +586,12 @@ public:
|
||||
|
||||
if (filter.empty())
|
||||
{
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_IP_BANNED_ALL);
|
||||
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_IP_BANNED_ALL);
|
||||
result = LoginDatabase.Query(stmt);
|
||||
}
|
||||
else
|
||||
{
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_IP_BANNED_BY_IP);
|
||||
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_IP_BANNED_BY_IP);
|
||||
stmt->setString(0, filter);
|
||||
result = LoginDatabase.Query(stmt);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user