Core/DBLayer: Prevent using prepared statements on wrong database

This commit is contained in:
Shauren
2019-07-27 01:00:37 +02:00
parent 1dcbceba81
commit e8e89f58fb
102 changed files with 604 additions and 577 deletions

View File

@@ -130,7 +130,7 @@ void MailDraft::deleteIncludedItems(SQLTransaction& trans, bool inDB /*= false*/
if (inDB)
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE);
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE);
stmt->setUInt64(0, item->GetGUID().GetCounter());
trans->Append(stmt);
}
@@ -170,7 +170,7 @@ void MailDraft::SendReturnToSender(uint32 sender_acc, ObjectGuid::LowType sender
Item* item = mailItemIter->second;
item->SaveToDB(trans); // item not in inventory and can be save standalone
// owner in data will set at mail receive and item extracting
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ITEM_OWNER);
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ITEM_OWNER);
stmt->setUInt64(0, receiver_guid);
stmt->setUInt64(1, item->GetGUID().GetCounter());
trans->Append(stmt);
@@ -215,7 +215,7 @@ void MailDraft::SendMailTo(SQLTransaction& trans, MailReceiver const& receiver,
// Add to DB
uint8 index = 0;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_MAIL);
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_MAIL);
stmt->setUInt32( index, mailId);
stmt->setUInt8 (++index, uint8(sender.GetMailMessageType()));
stmt->setInt8 (++index, int8(sender.GetStationery()));