summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2015-12-30 02:38:44 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2015-12-30 02:38:44 +0000
commit60c3118935426d1be13ed30964fdb5b4c8fb5970 (patch)
treea3362baabc51dfd5f1a926f32a6f07e5528d286c
parentUse TransactionScope instead of ScopeObject (diff)
downloadlibdbpp-60c3118935426d1be13ed30964fdb5b4c8fb5970.tar.bz2
libdbpp-60c3118935426d1be13ed30964fdb5b4c8fb5970.tar.xz
libdbpp-60c3118935426d1be13ed30964fdb5b4c8fb5970.zip
Add flags for enabling/disabling each phase of the table patch operationlibdbpp-1.0.1
-rw-r--r--libdbpp/tablepatch.cpp11
-rw-r--r--libdbpp/tablepatch.h6
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;
};
}