From 60c3118935426d1be13ed30964fdb5b4c8fb5970 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Wed, 30 Dec 2015 02:38:44 +0000 Subject: Add flags for enabling/disabling each phase of the table patch operation --- libdbpp/tablepatch.cpp | 11 +++++++---- libdbpp/tablepatch.h | 6 ++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/libdbpp/tablepatch.cpp b/libdbpp/tablepatch.cpp index f902739..dc42a42 100644 --- a/libdbpp/tablepatch.cpp +++ b/libdbpp/tablepatch.cpp @@ -10,7 +10,10 @@ DB::TablePatch::TablePatch() : insteadOfDelete(nullptr), where(nullptr), - order(nullptr) + order(nullptr), + doDeletes(true), + doUpdates(true), + doInserts(true) { } @@ -25,9 +28,9 @@ DB::Connection::patchTable(TablePatch * tp) } TransactionScope tx(this); return { - patchDeletes(tp), - patchUpdates(tp), - patchInserts(tp) + tp->doDeletes ? patchDeletes(tp) : 0, + tp->doUpdates ? patchUpdates(tp) : 0, + tp->doInserts ? patchInserts(tp) : 0 }; } diff --git a/libdbpp/tablepatch.h b/libdbpp/tablepatch.h index b197254..a8f5e59 100644 --- a/libdbpp/tablepatch.h +++ b/libdbpp/tablepatch.h @@ -38,6 +38,12 @@ namespace DB { SqlWriter * where; /// An optional SQL writer to append an order by clause. SqlWriter * order; + /// Enable deletion + bool doDeletes; + /// Enable updates + bool doUpdates; + /// Enable insertion + bool doInserts; }; } -- cgit v1.2.3