aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorariel- <ariel-@users.noreply.github.com>2016-07-16 20:11:15 -0300
committerjoschiwald <joschiwald.trinity@gmail.com>2017-02-05 21:07:31 +0100
commitf2c5c6995f438b1b631376e51514b8a2273f0054 (patch)
tree67f3ca08b8e317c0de79466530552bc35e146c99 /src
parente5e1834bd508b5c4e0a1c649cc0b711976662b53 (diff)
Core/World: fix race condition in _UpdateRealmCharCount
(cherry picked from commit 5251dadf2976cd0bfb38523af844da34af92561b)
Diffstat (limited to 'src')
-rw-r--r--src/server/game/World/World.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp
index 662a814cc03..3269fd615cb 100644
--- a/src/server/game/World/World.cpp
+++ b/src/server/game/World/World.cpp
@@ -3045,16 +3045,20 @@ void World::_UpdateRealmCharCount(PreparedQueryResult resultCharCount)
uint32 accountId = fields[0].GetUInt32();
uint8 charCount = uint8(fields[1].GetUInt64());
+ SQLTransaction trans = LoginDatabase.BeginTransaction();
+
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_REALM_CHARACTERS_BY_REALM);
stmt->setUInt32(0, accountId);
stmt->setUInt32(1, realm.Id.Realm);
- LoginDatabase.Execute(stmt);
+ trans->Append(stmt);
stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_REALM_CHARACTERS);
stmt->setUInt8(0, charCount);
stmt->setUInt32(1, accountId);
stmt->setUInt32(2, realm.Id.Realm);
- LoginDatabase.Execute(stmt);
+ trans->Append(stmt);
+
+ LoginDatabase.CommitTransaction(trans);
}
}