Core/DBLayer: Convert PAppend() queries to prepared statements No.1

This commit is contained in:
leak
2012-03-25 16:22:24 +02:00
parent 56fac5e1af
commit c6cbe4c77c
22 changed files with 288 additions and 91 deletions

View File

@@ -568,8 +568,18 @@ void ReputationMgr::SaveToDB(SQLTransaction& trans)
{
if (itr->second.needSave)
{
trans->PAppend("DELETE FROM character_reputation WHERE guid = '%u' AND faction='%u'", _player->GetGUIDLow(), itr->second.ID);
trans->PAppend("INSERT INTO character_reputation (guid, faction, standing, flags) VALUES ('%u', '%u', '%i', '%u')", _player->GetGUIDLow(), itr->second.ID, itr->second.Standing, itr->second.Flags);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_REPUTATION_BY_FACTION);
stmt->setUInt32(0, _player->GetGUIDLow());
stmt->setUInt16(1, uint16(itr->second.ID));
trans->Append(stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_REPUTATION_BY_FACTION);
stmt->setUInt32(0, _player->GetGUIDLow());
stmt->setUInt16(1, uint16(itr->second.ID));
stmt->setInt32(2, itr->second.Standing);
stmt->setUInt16(3, uint16(itr->second.Flags));
trans->Append(stmt);
itr->second.needSave = false;
}
}