[pmg-devel] [PATCH pmg-api 1/2] ruledb: disclaimer: simplify update-case
Stoiko Ivanov
s.ivanov at proxmox.com
Wed Feb 12 16:12:38 CET 2025
as one object(_id) belongs is of one object type, we can safely remove
all associated attribut entries from the database at once instead of
running 2 separate statements to delete each individually
noticed this while adding new attribut entries to the content-type
check.
Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
src/PMG/RuleDB/Disclaimer.pm | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/src/PMG/RuleDB/Disclaimer.pm b/src/PMG/RuleDB/Disclaimer.pm
index 574f62e..cb9b5fb 100644
--- a/src/PMG/RuleDB/Disclaimer.pm
+++ b/src/PMG/RuleDB/Disclaimer.pm
@@ -113,11 +113,9 @@ sub save {
"UPDATE Object SET Value = ? WHERE ID = ?",
undef, $value, $self->{id});
- for my $prop (qw(top separator)) {
- $ruledb->{dbh}->do(
- "DELETE FROM Attribut WHERE Name = ? and Object_ID = ?",
- undef, $prop, $self->{id});
- }
+ $ruledb->{dbh}->do(
+ "DELETE FROM Attribut WHERE Object_ID = ?",
+ undef, $self->{id});
} else {
# insert
--
2.39.5
More information about the pmg-devel
mailing list