diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2022-02-14 14:47:16 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2022-02-14 14:47:38 +0000 |
commit | bd740e5a782c1d491ad92fc3601bf4c743599b37 (patch) | |
tree | 3f7d8c136bfe2620f90e8205169b8daf830303a6 | |
parent | Tidy includes (diff) | |
download | libdbpp-bd740e5a782c1d491ad92fc3601bf4c743599b37.tar.bz2 libdbpp-bd740e5a782c1d491ad92fc3601bf4c743599b37.tar.xz libdbpp-bd740e5a782c1d491ad92fc3601bf4c743599b37.zip |
enum class BulkUpdates
-rw-r--r-- | libdbpp/connection.h | 14 | ||||
-rw-r--r-- | libdbpp/tablepatch.cpp | 12 | ||||
-rw-r--r-- | libdbpp/unittests/mockdb.cpp | 4 |
3 files changed, 15 insertions, 15 deletions
diff --git a/libdbpp/connection.h b/libdbpp/connection.h index f14eec1..8bf74af 100644 --- a/libdbpp/connection.h +++ b/libdbpp/connection.h @@ -23,15 +23,15 @@ namespace DB { class TablePatch; - enum BulkDeleteStyle { - BulkDeleteUsingSubSelect, - BulkDeleteUsingUsing, - BulkDeleteUsingUsingAlias, + enum class BulkDeleteStyle { + UsingSubSelect, + UsingUsing, + UsingUsingAlias, }; - enum BulkUpdateStyle { - BulkUpdateUsingFromSrc = 1, - BulkUpdateUsingJoin = 2, + enum class BulkUpdateStyle { + UsingFromSrc = 1, + UsingJoin = 2, }; using TableName = std::string; diff --git a/libdbpp/tablepatch.cpp b/libdbpp/tablepatch.cpp index 9484a74..132e28c 100644 --- a/libdbpp/tablepatch.cpp +++ b/libdbpp/tablepatch.cpp @@ -132,7 +132,7 @@ DB::Connection::patchDeletes(TablePatch * tp) } AdHoc::Buffer toDelSql; switch (bulkDeleteStyle()) { - case BulkDeleteUsingSubSelect: { + case BulkDeleteStyle::UsingSubSelect: { // ----------------------------------------------------------------- // Build SQL to delete keys ---------------------------------------- // ----------------------------------------------------------------- @@ -163,14 +163,14 @@ DB::Connection::patchDeletes(TablePatch * tp) toDelSql.append(")"); break; } - case BulkDeleteUsingUsingAlias: - case BulkDeleteUsingUsing: { + case BulkDeleteStyle::UsingUsingAlias: + case BulkDeleteStyle::UsingUsing: { if (tp->insteadOfDelete) { toDelSql.appendbf("UPDATE %s a ", tp->dest); } else { toDelSql.appendbf("DELETE FROM %s USING %s a ", - (bulkDeleteStyle() == BulkDeleteUsingUsingAlias ? "a" : tp->dest), tp->dest); + (bulkDeleteStyle() == BulkDeleteStyle::UsingUsingAlias ? "a" : tp->dest), tp->dest); } toDelSql.append(" LEFT OUTER JOIN "); tp->srcExpr->writeSql(toDelSql); @@ -247,7 +247,7 @@ DB::Connection::patchUpdates(TablePatch * tp) tp->beforeUpdate(upd); } switch (bulkUpdateStyle()) { - case BulkUpdateUsingFromSrc: { + case BulkUpdateStyle::UsingFromSrc: { // ----------------------------------------------------------------- // Build SQL for list of updates to perform ------------------------ // ----------------------------------------------------------------- @@ -269,7 +269,7 @@ DB::Connection::patchUpdates(TablePatch * tp) } return upd->execute(true); } break; - case BulkUpdateUsingJoin: { + case BulkUpdateStyle::UsingJoin: { // ----------------------------------------------------------------- // Build SQL for list of updates to perform ------------------------ // ----------------------------------------------------------------- diff --git a/libdbpp/unittests/mockdb.cpp b/libdbpp/unittests/mockdb.cpp index 15e07fb..247a724 100644 --- a/libdbpp/unittests/mockdb.cpp +++ b/libdbpp/unittests/mockdb.cpp @@ -32,13 +32,13 @@ MockDb::ping() const DB::BulkDeleteStyle MockDb::bulkDeleteStyle() const { - return DB::BulkDeleteUsingUsing; + return DB::BulkDeleteStyle::UsingUsing; } DB::BulkUpdateStyle MockDb::bulkUpdateStyle() const { - return DB::BulkUpdateUsingJoin; + return DB::BulkUpdateStyle::UsingJoin; } void |