]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#714,!409] Addressed review comments.
authorMarcin Siodelski <marcin@isc.org>
Thu, 4 Jul 2019 19:45:37 +0000 (21:45 +0200)
committerMarcin Siodelski <marcin@isc.org>
Thu, 4 Jul 2019 19:48:15 +0000 (15:48 -0400)
Removed unnecessary queries before create/update.

src/hooks/dhcp/mysql_cb/mysql_cb_dhcp4.cc
src/hooks/dhcp/mysql_cb/mysql_cb_dhcp6.cc

index 162fe07a612f2a4400571adb2792eb267be1830d..3a57105e5c5641d557315e220328048292b0207b 100644 (file)
@@ -1449,9 +1449,6 @@ public:
         };
 
         MySqlTransaction transaction(conn_);
-        OptionDescriptorPtr existing_option =
-            getOption(GET_OPTION4_CODE_SPACE, Option::V4, server_selector,
-                      option->option_->getType(), option->space_name_);
 
         // Create scoped audit revision. As long as this instance exists
         // no new audit revisions are created in any subsequent calls.
@@ -1517,12 +1514,6 @@ public:
             transaction.reset(new MySqlTransaction(conn_));
         }
 
-        OptionDescriptorPtr existing_option =
-            getOption(GET_OPTION4_SUBNET_ID_CODE_SPACE, Option::V4,
-                      server_selector, subnet_id,
-                      option->option_->getType(),
-                      option->space_name_);
-
         // Create scoped audit revision. As long as this instance exists
         // no new audit revisions are created in any subsequent calls.
         ScopedAuditRevision
@@ -1607,11 +1598,6 @@ public:
 
         MySqlTransaction transaction(conn_);
 
-        OptionDescriptorPtr existing_option =
-            getOption(GET_OPTION4_POOL_ID_CODE_SPACE,
-                      server_selector, Lease::TYPE_V4, pool_id,
-                      option->option_->getType(), option->space_name_);
-
         // Create scoped audit revision. As long as this instance exists
         // no new audit revisions are created in any subsequent calls.
         ScopedAuditRevision
@@ -1678,11 +1664,6 @@ public:
             transaction.reset(new MySqlTransaction(conn_));
         }
 
-        OptionDescriptorPtr existing_option =
-            getOption(GET_OPTION4_SHARED_NETWORK_CODE_SPACE, Option::V4,
-                      server_selector, shared_network_name,
-                      option->option_->getType(), option->space_name_);
-
         // Create scoped audit revision. As long as this instance exists
         // no new audit revisions are created in any subsequent calls.
         ScopedAuditRevision
index fa46affb10efe85537ff82cf4c3d845c79a0c9da..94a4537d4f7597bcaf35798a27e71d5a48e1a5fd 100644 (file)
@@ -1661,9 +1661,6 @@ public:
         };
 
         MySqlTransaction transaction(conn_);
-        OptionDescriptorPtr existing_option =
-            getOption(GET_OPTION6_CODE_SPACE, Option::V6, server_selector,
-                      option->option_->getType(), option->space_name_);
 
         // Create scoped audit revision. As long as this instance exists
         // no new audit revisions are created in any subsequent calls.
@@ -1730,12 +1727,6 @@ public:
             transaction.reset(new MySqlTransaction(conn_));
         }
 
-        OptionDescriptorPtr existing_option =
-            getOption(GET_OPTION6_SUBNET_ID_CODE_SPACE, Option::V6,
-                      server_selector, subnet_id,
-                      option->option_->getType(),
-                      option->space_name_);
-
         // Create scoped audit revision. As long as this instance exists
         // no new audit revisions are created in any subsequent calls.
         ScopedAuditRevision
@@ -1885,13 +1876,6 @@ public:
 
         MySqlTransaction transaction(conn_);
 
-        int index = (pool_type == Lease::TYPE_NA ?
-                     GET_OPTION6_POOL_ID_CODE_SPACE :
-                     GET_OPTION6_PD_POOL_ID_CODE_SPACE);
-        OptionDescriptorPtr existing_option =
-            getOption(index, server_selector, pool_type, pool_id,
-                      option->option_->getType(), option->space_name_);
-
         // Create scoped audit revision. As long as this instance exists
         // no new audit revisions are created in any subsequent calls.
         if (pool_type == Lease::TYPE_PD) {
@@ -1905,9 +1889,9 @@ public:
                            MySqlConfigBackendDHCPv6Impl::CREATE_AUDIT_REVISION,
                            server_selector, msg, cascade_update);
 
-        index = (pool_type == Lease::TYPE_NA ?
-                 MySqlConfigBackendDHCPv6Impl::UPDATE_OPTION6_POOL_ID :
-                 MySqlConfigBackendDHCPv6Impl::UPDATE_OPTION6_PD_POOL_ID);
+        auto index = (pool_type == Lease::TYPE_NA ?
+                      MySqlConfigBackendDHCPv6Impl::UPDATE_OPTION6_POOL_ID :
+                      MySqlConfigBackendDHCPv6Impl::UPDATE_OPTION6_PD_POOL_ID);
         if (conn_.updateDeleteQuery(index, in_bindings) == 0) {
             // Remove the 4 bindings used only in case of update.
             in_bindings.resize(in_bindings.size() - 4);
@@ -1966,11 +1950,6 @@ public:
             transaction.reset(new MySqlTransaction(conn_));
         }
 
-        OptionDescriptorPtr existing_option =
-            getOption(GET_OPTION6_SHARED_NETWORK_CODE_SPACE, Option::V6,
-                      server_selector, shared_network_name,
-                      option->option_->getType(), option->space_name_);
-
         // Create scoped audit revision. As long as this instance exists
         // no new audit revisions are created in any subsequent calls.
         ScopedAuditRevision