]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#2322] Addressed review comments
authorThomas Markwalder <tmark@isc.org>
Tue, 1 Mar 2022 22:02:22 +0000 (17:02 -0500)
committerThomas Markwalder <tmark@isc.org>
Tue, 1 Mar 2022 22:02:22 +0000 (17:02 -0500)
src/hooks/dhcp/pgsql_cb/pgsql_cb_dhcp4.cc
    Minor cleanup

src/hooks/dhcp/pgsql_cb/pgsql_cb_dhcp4.cc

index a7181bcd80b187c81de3cd914adbf1d53bdb0f5e..e2caba1dcb4435c268339d9065260e0c8aea2aef 100644 (file)
@@ -2449,18 +2449,17 @@ public:
             deleteOptions4(ServerSelector::ANY(), client_class);
             deleteOptionDefs4(ServerSelector::ANY(), client_class);
 
-            if (follow_class_name.empty()) {
-                // leave follow name on there, SQL ignores it
-                // in_bindings.popBack();
+            // Note follow_class_name is left in the bindings even though it is
+            // needed in both cases. This allows us to use one base query.
+            // Add the class name for the where clause.
+            in_bindings.add(class_name);
 
-                // Add the class name for the where clause.
-                in_bindings.add(class_name);
+            if (follow_class_name.empty()) {
+                // If position is not specified, leave the class at the same position.
                 updateDeleteQuery(PgSqlConfigBackendDHCPv4Impl::UPDATE_CLIENT_CLASS4_SAME_POSITION,
                                   in_bindings);
             } else {
                 // Update with follow_class_name specifying the position.
-                // Add the class name for the where clause.
-                in_bindings.add(class_name);
                 updateDeleteQuery(PgSqlConfigBackendDHCPv4Impl::UPDATE_CLIENT_CLASS4,
                                   in_bindings);
             }