Revert parts of a previous transaction-fix (would create a nested transaction), add missing support for rollback in battleground-group creation

--HG--
branch : trunk
This commit is contained in:
click
2010-05-03 16:30:53 +02:00
parent 2c31b77129
commit 9fbdcbb706
3 changed files with 7 additions and 4 deletions
+4 -1
View File
@@ -116,7 +116,10 @@ bool Group::Create(const uint64 &guid, const char * name)
} }
if (!AddMember(guid, name)) if (!AddMember(guid, name))
{
CharacterDatabase.RollbackTransaction();
return false; return false;
}
if (!isBGGroup()) CharacterDatabase.CommitTransaction(); if (!isBGGroup()) CharacterDatabase.CommitTransaction();
@@ -1288,7 +1291,7 @@ void Group::_setLeader(const uint64 &guid)
"DELETE FROM group_instance WHERE leaderguid='%u' AND (permanent = 1 OR " "DELETE FROM group_instance WHERE leaderguid='%u' AND (permanent = 1 OR "
"instance IN (SELECT instance FROM character_instance WHERE guid = '%u')" "instance IN (SELECT instance FROM character_instance WHERE guid = '%u')"
")", GUID_LOPART(m_leaderGuid), GUID_LOPART(slot->guid) ")", GUID_LOPART(m_leaderGuid), GUID_LOPART(slot->guid)
); );
Player *player = objmgr.GetPlayer(slot->guid); Player *player = objmgr.GetPlayer(slot->guid);
if (player) if (player)
+1 -2
View File
@@ -354,8 +354,7 @@ void WorldSession::HandleMailReturnToSender(WorldPacket & recv_data)
//we can return mail now //we can return mail now
//so firstly delete the old one //so firstly delete the old one
CharacterDatabase.BeginTransaction(); CharacterDatabase.BeginTransaction();
CharacterDatabase.PExecute("DELETE FROM mail WHERE id = '%u'", mailId); CharacterDatabase.PExecute("DELETE FROM mail WHERE id = '%u'", mailId); // needed?
// needed?
CharacterDatabase.PExecute("DELETE FROM mail_items WHERE mail_id = '%u'", mailId); CharacterDatabase.PExecute("DELETE FROM mail_items WHERE mail_id = '%u'", mailId);
CharacterDatabase.CommitTransaction(); CharacterDatabase.CommitTransaction();
pl->RemoveMail(mailId); pl->RemoveMail(mailId);
+2 -1
View File
@@ -17542,11 +17542,12 @@ void Player::SaveToDB()
if (m_session->isLogingOut() || !sWorld.getConfig(CONFIG_STATS_SAVE_ONLY_ON_LOGOUT)) if (m_session->isLogingOut() || !sWorld.getConfig(CONFIG_STATS_SAVE_ONLY_ON_LOGOUT))
_SaveStats(); _SaveStats();
CharacterDatabase.CommitTransaction();
// save pet (hunter pet level and experience and all type pets health/mana). // save pet (hunter pet level and experience and all type pets health/mana).
if (Pet* pet = GetPet()) if (Pet* pet = GetPet())
pet->SavePetToDB(PET_SAVE_AS_CURRENT); pet->SavePetToDB(PET_SAVE_AS_CURRENT);
CharacterDatabase.CommitTransaction();
} }
// fast save function for item/money cheating preventing - save only inventory and money state // fast save function for item/money cheating preventing - save only inventory and money state