aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorclick <none@none>2010-05-03 16:30:53 +0200
committerclick <none@none>2010-05-03 16:30:53 +0200
commit9fbdcbb706d51ee696e453d311da6bdad515731d (patch)
tree9998977a81fe3e66a0ce87a85de9ddfb9979d11b
parent2c31b77129cb74f28a1fde8927c6d49d49f8c1c7 (diff)
Revert parts of a previous transaction-fix (would create a nested transaction), add missing support for rollback in battleground-group creation
--HG-- branch : trunk
-rw-r--r--src/game/Group.cpp5
-rw-r--r--src/game/Mail.cpp3
-rw-r--r--src/game/Player.cpp3
3 files changed, 7 insertions, 4 deletions
diff --git a/src/game/Group.cpp b/src/game/Group.cpp
index 0d9fc5eadf7..1bc542ec08a 100644
--- a/src/game/Group.cpp
+++ b/src/game/Group.cpp
@@ -116,7 +116,10 @@ bool Group::Create(const uint64 &guid, const char * name)
}
if (!AddMember(guid, name))
+ {
+ CharacterDatabase.RollbackTransaction();
return false;
+ }
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 "
"instance IN (SELECT instance FROM character_instance WHERE guid = '%u')"
")", GUID_LOPART(m_leaderGuid), GUID_LOPART(slot->guid)
-);
+ );
Player *player = objmgr.GetPlayer(slot->guid);
if (player)
diff --git a/src/game/Mail.cpp b/src/game/Mail.cpp
index 7ccb2b2c074..624e1ae78f3 100644
--- a/src/game/Mail.cpp
+++ b/src/game/Mail.cpp
@@ -354,8 +354,7 @@ void WorldSession::HandleMailReturnToSender(WorldPacket & recv_data)
//we can return mail now
//so firstly delete the old one
CharacterDatabase.BeginTransaction();
- CharacterDatabase.PExecute("DELETE FROM mail WHERE id = '%u'", mailId);
- // needed?
+ CharacterDatabase.PExecute("DELETE FROM mail WHERE id = '%u'", mailId); // needed?
CharacterDatabase.PExecute("DELETE FROM mail_items WHERE mail_id = '%u'", mailId);
CharacterDatabase.CommitTransaction();
pl->RemoveMail(mailId);
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 9e6c1fa6a06..8f151296196 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -17542,11 +17542,12 @@ void Player::SaveToDB()
if (m_session->isLogingOut() || !sWorld.getConfig(CONFIG_STATS_SAVE_ONLY_ON_LOGOUT))
_SaveStats();
+ CharacterDatabase.CommitTransaction();
+
// save pet (hunter pet level and experience and all type pets health/mana).
if (Pet* pet = GetPet())
pet->SavePetToDB(PET_SAVE_AS_CURRENT);
- CharacterDatabase.CommitTransaction();
}
// fast save function for item/money cheating preventing - save only inventory and money state