Core/DBLayer: Prevent using prepared statements on wrong database

This commit is contained in:
Shauren authored and Ovahlord committed 2020-04-15 19:18:58 +02:00
1 parent eaee7b3cfa
commit d003ebd8e4
98 files changed
+569 -541

No files matched your search

+5 -5
View File
@@ -568,7 +568,7 @@ void WorldSession::LogoutPlayer(bool save)
// track if player logs out after invited to join BG
if (_player->IsInvitedForBattlegroundQueueType(bgQueueTypeId) && sWorld->getBoolConfig(CONFIG_BATTLEGROUND_TRACK_DESERTERS))
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_DESERTER_TRACK);
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_DESERTER_TRACK);
stmt->setUInt32(0, _player->GetGUID().GetCounter());
stmt->setUInt8(1, BG_DESERTION_TYPE_INVITE_LOGOUT);
CharacterDatabase.Execute(stmt);
@@ -659,7 +659,7 @@ void WorldSession::LogoutPlayer(bool save)
TC_LOG_DEBUG("network", "SESSION: Sent SMSG_LOGOUT_COMPLETE Message");
//! Since each account can only have one online character at any given time, ensure all characters for active account are marked as offline
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ACCOUNT_ONLINE);
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ACCOUNT_ONLINE);
stmt->setUInt32(0, GetAccountId());
CharacterDatabase.Execute(stmt);
}
@@ -835,7 +835,7 @@ void WorldSession::SetAccountData(AccountDataType type, time_t tm, std::string c
index = CHAR_REP_PLAYER_ACCOUNT_DATA;
}
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(index);
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(index);
stmt->setUInt32(0, id);
stmt->setUInt8 (1, type);
stmt->setUInt32(2, uint32(tm));
@@ -886,7 +886,7 @@ void WorldSession::SaveTutorialsData(SQLTransaction &trans)
return;
bool const hasTutorialsInDB = (m_TutorialsChanged & TUTORIALS_FLAG_LOADED_FROM_DB) != 0;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(hasTutorialsInDB ? CHAR_UPD_TUTORIALS : CHAR_INS_TUTORIALS);
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(hasTutorialsInDB ? CHAR_UPD_TUTORIALS : CHAR_INS_TUTORIALS);
for (uint8 i = 0; i < MAX_ACCOUNT_TUTORIAL_VALUES; ++i)
stmt->setUInt32(i, m_Tutorials[i]);
stmt->setUInt32(MAX_ACCOUNT_TUTORIAL_VALUES, GetAccountId());
@@ -1185,7 +1185,7 @@ public:
{
bool ok = true;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ACCOUNT_DATA);
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ACCOUNT_DATA);
stmt->setUInt32(0, accountId);
ok = SetPreparedQuery(GLOBAL_ACCOUNT_DATA, stmt) && ok;