summaryrefslogtreecommitdiff
path: root/src/account-server/serverhandler.cpp
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2010-10-30 10:22:17 +0200
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2010-10-30 10:59:07 +0200
commite4713d0203311fdfcfef72ae5632782075159a56 (patch)
treeca2ce2177b608a87b50c80837c607fa513e00ea3 /src/account-server/serverhandler.cpp
parenta84572c5449c74d9107a9c725a5feb32e439843e (diff)
downloadmanaserv-e4713d0203311fdfcfef72ae5632782075159a56.tar.gz
manaserv-e4713d0203311fdfcfef72ae5632782075159a56.tar.bz2
manaserv-e4713d0203311fdfcfef72ae5632782075159a56.tar.xz
manaserv-e4713d0203311fdfcfef72ae5632782075159a56.zip
Introduced a helper class for performing transactions
Avoids having to remember to call rollbackTransaction and makes transactions exception-safe (since the destructor of PerformTransaction will be called when an exception is thrown).
Diffstat (limited to 'src/account-server/serverhandler.cpp')
-rw-r--r--src/account-server/serverhandler.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/account-server/serverhandler.cpp b/src/account-server/serverhandler.cpp
index 9ca9e281..b81be075 100644
--- a/src/account-server/serverhandler.cpp
+++ b/src/account-server/serverhandler.cpp
@@ -553,7 +553,7 @@ void GameServerHandler::sendPartyChange(Character *ptr, int partyId)
void GameServerHandler::syncDatabase(MessageIn &msg)
{
// It is safe to perform the following updates in a transaction
- storage->database()->beginTransaction();
+ dal::PerformTransaction transaction(storage->database());
int msgType = msg.readByte();
while (msgType != SYNC_END_OF_BUFFER && msg.getUnreadLength() > 0)
@@ -602,5 +602,5 @@ void GameServerHandler::syncDatabase(MessageIn &msg)
msgType = msg.readByte();
}
- storage->database()->commitTransaction();
+ transaction.commit();
}