summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2015-12-30 02:35:04 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2015-12-30 02:35:04 +0000
commit338ef7bb173561b186b183bfa898cf978b5ac200 (patch)
treebbf8d46cbcdb5452390d62871eb6d1890a0967ec
parentImprove and centralise transaction handling logic (diff)
downloadlibdbpp-338ef7bb173561b186b183bfa898cf978b5ac200.tar.bz2
libdbpp-338ef7bb173561b186b183bfa898cf978b5ac200.tar.xz
libdbpp-338ef7bb173561b186b183bfa898cf978b5ac200.zip
Use TransactionScope instead of ScopeObject
-rw-r--r--libdbpp/tablepatch.cpp8
1 files changed, 1 insertions, 7 deletions
diff --git a/libdbpp/tablepatch.cpp b/libdbpp/tablepatch.cpp
index 114a2b4..f902739 100644
--- a/libdbpp/tablepatch.cpp
+++ b/libdbpp/tablepatch.cpp
@@ -5,7 +5,6 @@
#include "sqlWriter.h"
#include <buffer.h>
#include <safeMapFind.h>
-#include <scopeExit.h>
#include <boost/algorithm/string/join.hpp>
DB::TablePatch::TablePatch() :
@@ -24,12 +23,7 @@ DB::Connection::patchTable(TablePatch * tp)
if (!inTx()) {
throw TransactionRequired();
}
- auto savepointName = stringbf("TablePatch_%p_%d", tp, getpid());
- savepoint(savepointName);
- AdHoc::ScopeExit _(AdHoc::ScopeExit::Event(),
- [this, savepointName](){ releaseSavepoint(savepointName); },
- [this, savepointName](){ rollbackToSavepoint(savepointName); }
- );
+ TransactionScope tx(this);
return {
patchDeletes(tp),
patchUpdates(tp),