diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-12-30 02:35:04 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-12-30 02:35:04 +0000 |
commit | 338ef7bb173561b186b183bfa898cf978b5ac200 (patch) | |
tree | bbf8d46cbcdb5452390d62871eb6d1890a0967ec | |
parent | Improve and centralise transaction handling logic (diff) | |
download | libdbpp-338ef7bb173561b186b183bfa898cf978b5ac200.tar.bz2 libdbpp-338ef7bb173561b186b183bfa898cf978b5ac200.tar.xz libdbpp-338ef7bb173561b186b183bfa898cf978b5ac200.zip |
Use TransactionScope instead of ScopeObject
-rw-r--r-- | libdbpp/tablepatch.cpp | 8 |
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), |