mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-30 05:43:12 +01:00
DB Layer:
- Make SQL Transactions actual objects used in code. (Thanks to Derex for the idea) * Uncommitted transactions will be automatically rolled back and cleaned up using ACE_Refcounted_Auto_Ptr, so no need to call Rollback() in the code. * Prevents recursive transactions and makes developers aware of transactions going on. * Gets rid of unneccesary overhead iterating over a concurrent map. - Some cleanups in affected code, including better usage of transaction control in AH / mail related code to prevent data loss. *** Experimental, use at own risk, recommended to backup your DBs. *** --HG-- branch : trunk
This commit is contained in:
@@ -508,14 +508,14 @@ void ReputationMgr::LoadFromDB(QueryResult_AutoPtr result)
|
||||
}
|
||||
}
|
||||
|
||||
void ReputationMgr::SaveToDB()
|
||||
void ReputationMgr::SaveToDB(SQLTransaction& trans)
|
||||
{
|
||||
for (FactionStateList::iterator itr = m_factions.begin(); itr != m_factions.end(); ++itr)
|
||||
{
|
||||
if (itr->second.Changed)
|
||||
{
|
||||
CharacterDatabase.PExecute("DELETE FROM character_reputation WHERE guid = '%u' AND faction='%u'", m_player->GetGUIDLow(), itr->second.ID);
|
||||
CharacterDatabase.PExecute("INSERT INTO character_reputation (guid,faction,standing,flags) VALUES ('%u', '%u', '%i', '%u')", m_player->GetGUIDLow(), itr->second.ID, itr->second.Standing, itr->second.Flags);
|
||||
trans->PAppend("DELETE FROM character_reputation WHERE guid = '%u' AND faction='%u'", m_player->GetGUIDLow(), itr->second.ID);
|
||||
trans->PAppend("INSERT INTO character_reputation (guid,faction,standing,flags) VALUES ('%u', '%u', '%i', '%u')", m_player->GetGUIDLow(), itr->second.ID, itr->second.Standing, itr->second.Flags);
|
||||
itr->second.Changed = false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user