From: Thomas Markwalder Date: Tue, 1 Mar 2022 22:02:22 +0000 (-0500) Subject: [#2322] Addressed review comments X-Git-Tag: Kea-2.1.4~72 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=462bb25e481ceec4774944838c2551d53a35dfb6;p=thirdparty%2Fkea.git [#2322] Addressed review comments src/hooks/dhcp/pgsql_cb/pgsql_cb_dhcp4.cc Minor cleanup --- diff --git a/src/hooks/dhcp/pgsql_cb/pgsql_cb_dhcp4.cc b/src/hooks/dhcp/pgsql_cb/pgsql_cb_dhcp4.cc index a7181bcd80..e2caba1dcb 100644 --- a/src/hooks/dhcp/pgsql_cb/pgsql_cb_dhcp4.cc +++ b/src/hooks/dhcp/pgsql_cb/pgsql_cb_dhcp4.cc @@ -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); }