Core/DBLayer: Prevent using prepared statements on wrong database
This commit is contained in:
@@ -128,7 +128,7 @@ public:
|
||||
{
|
||||
if (sWorld->getBoolConfig(CONFIG_BATTLEGROUND_STORE_STATISTICS_ENABLE))
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PVPSTATS_FACTIONS_OVERALL);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PVPSTATS_FACTIONS_OVERALL);
|
||||
PreparedQueryResult result = CharacterDatabase.Query(stmt);
|
||||
|
||||
if (result)
|
||||
@@ -1000,7 +1000,7 @@ public:
|
||||
|
||||
if (!player)
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_HOMEBIND);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_HOMEBIND);
|
||||
stmt->setUInt64(0, targetGUID.GetCounter());
|
||||
PreparedQueryResult result = CharacterDatabase.Query(stmt);
|
||||
if (result)
|
||||
@@ -1594,7 +1594,7 @@ public:
|
||||
Player* target;
|
||||
ObjectGuid targetGuid;
|
||||
std::string targetName;
|
||||
PreparedStatement* stmt = NULL;
|
||||
CharacterDatabasePreparedStatement* stmt = NULL;
|
||||
|
||||
// To make sure we get a target, we convert our guid to an omniversal...
|
||||
ObjectGuid parseGUID = ObjectGuid::Create<HighGuid::Player>(strtoull(args, nullptr, 10));
|
||||
@@ -1748,10 +1748,10 @@ public:
|
||||
}
|
||||
|
||||
// Query the prepared statement for login data
|
||||
stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_PINFO);
|
||||
stmt->setInt32(0, int32(realm.Id.Realm));
|
||||
stmt->setUInt32(1, accId);
|
||||
PreparedQueryResult result = LoginDatabase.Query(stmt);
|
||||
LoginDatabasePreparedStatement* stmt2 = LoginDatabase.GetPreparedStatement(LOGIN_SEL_PINFO);
|
||||
stmt2->setInt32(0, int32(realm.Id.Realm));
|
||||
stmt2->setUInt32(1, accId);
|
||||
PreparedQueryResult result = LoginDatabase.Query(stmt2);
|
||||
|
||||
if (result)
|
||||
{
|
||||
@@ -1794,7 +1794,7 @@ public:
|
||||
std::string nameLink = handler->playerLink(targetName);
|
||||
|
||||
// Returns banType, banTime, bannedBy, banreason
|
||||
PreparedStatement* stmt2 = LoginDatabase.GetPreparedStatement(LOGIN_SEL_PINFO_BANS);
|
||||
stmt2 = LoginDatabase.GetPreparedStatement(LOGIN_SEL_PINFO_BANS);
|
||||
stmt2->setUInt32(0, accId);
|
||||
PreparedQueryResult result2 = LoginDatabase.Query(stmt2);
|
||||
if (!result2)
|
||||
@@ -1814,9 +1814,9 @@ public:
|
||||
}
|
||||
|
||||
// Can be used to query data from Characters database
|
||||
stmt2 = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PINFO_XP);
|
||||
stmt2->setUInt64(0, lowguid);
|
||||
PreparedQueryResult result4 = CharacterDatabase.Query(stmt2);
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PINFO_XP);
|
||||
stmt->setUInt64(0, lowguid);
|
||||
PreparedQueryResult result4 = CharacterDatabase.Query(stmt);
|
||||
|
||||
if (result4)
|
||||
{
|
||||
@@ -1828,9 +1828,9 @@ public:
|
||||
if (gguid)
|
||||
{
|
||||
// Guild Data - an own query, because it may not happen.
|
||||
PreparedStatement* stmt3 = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUILD_MEMBER_EXTENDED);
|
||||
stmt3->setUInt64(0, lowguid);
|
||||
PreparedQueryResult result5 = CharacterDatabase.Query(stmt3);
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUILD_MEMBER_EXTENDED);
|
||||
stmt->setUInt64(0, lowguid);
|
||||
PreparedQueryResult result5 = CharacterDatabase.Query(stmt);
|
||||
if (result5)
|
||||
{
|
||||
Field* fields5 = result5->Fetch();
|
||||
@@ -1932,9 +1932,9 @@ public:
|
||||
|
||||
// Mail Data - an own query, because it may or may not be useful.
|
||||
// SQL: "SELECT SUM(CASE WHEN (checked & 1) THEN 1 ELSE 0 END) AS 'readmail', COUNT(*) AS 'totalmail' FROM mail WHERE `receiver` = ?"
|
||||
PreparedStatement* stmt4 = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PINFO_MAILS);
|
||||
stmt4->setUInt64(0, lowguid);
|
||||
PreparedQueryResult result6 = CharacterDatabase.Query(stmt4);
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PINFO_MAILS);
|
||||
stmt->setUInt64(0, lowguid);
|
||||
PreparedQueryResult result6 = CharacterDatabase.Query(stmt);
|
||||
if (result6)
|
||||
{
|
||||
Field* fields = result6->Fetch();
|
||||
@@ -2009,7 +2009,7 @@ public:
|
||||
if (handler->HasLowerSecurity (target, targetGuid, true))
|
||||
return false;
|
||||
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME);
|
||||
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME);
|
||||
std::string muteBy = "";
|
||||
if (handler->GetSession())
|
||||
muteBy = handler->GetSession()->GetPlayerName();
|
||||
@@ -2088,7 +2088,7 @@ public:
|
||||
target->GetSession()->m_muteTime = 0;
|
||||
}
|
||||
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME);
|
||||
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME);
|
||||
stmt->setInt64(0, 0);
|
||||
stmt->setString(1, "");
|
||||
stmt->setString(2, "");
|
||||
@@ -2136,7 +2136,7 @@ public:
|
||||
// helper for mutehistory
|
||||
static bool HandleMuteInfoHelper(uint32 accountId, char const* accountName, ChatHandler *handler)
|
||||
{
|
||||
PreparedStatement *stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_MUTE_INFO);
|
||||
LoginDatabasePreparedStatement *stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_MUTE_INFO);
|
||||
stmt->setUInt32(0, accountId);
|
||||
PreparedQueryResult result = LoginDatabase.Query(stmt);
|
||||
|
||||
@@ -2630,7 +2630,7 @@ public:
|
||||
}
|
||||
|
||||
// If player found: delete his freeze aura
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_AURA_FROZEN);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_AURA_FROZEN);
|
||||
stmt->setUInt64(0, guid.GetCounter());
|
||||
CharacterDatabase.Execute(stmt);
|
||||
|
||||
@@ -2650,7 +2650,7 @@ public:
|
||||
static bool HandleListFreezeCommand(ChatHandler* handler, char const* /*args*/)
|
||||
{
|
||||
// Get names from DB
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_AURA_FROZEN);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_AURA_FROZEN);
|
||||
PreparedQueryResult result = CharacterDatabase.Query(stmt);
|
||||
if (!result)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user