diff options
| author | ariel- <ariel-@users.noreply.github.com> | 2016-07-16 20:11:15 -0300 |
|---|---|---|
| committer | ariel- <ariel-@users.noreply.github.com> | 2016-07-16 20:11:15 -0300 |
| commit | 5251dadf2976cd0bfb38523af844da34af92561b (patch) | |
| tree | 9903631bca8e3eb34d385279115240469445b95f /src | |
| parent | dda338ece607367f6370f01dfdc54ff7cc55b92b (diff) | |
Core/World: fix race condition in _UpdateRealmCharCount
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/game/World/World.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 551fbfe5474..1334599e9d5 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -2887,16 +2887,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); } } |
