]> git.mxchange.org Git - fba.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Sun, 15 Sep 2024 10:23:43 +0000 (12:23 +0200)
committerRoland Häder <roland@mxchange.org>
Sun, 15 Sep 2024 10:23:43 +0000 (12:23 +0200)
- these DELETE SQL statements have already been encapsulated

fba/commands.py
fba/models/blocks.py

index 091ac9993092d09b470d4244b32e6094f7b0ab0c..6726b025472bd1981617f77026cca27d2b8d2496 100644 (file)
@@ -2071,8 +2071,8 @@ def remove_invalid(args: argparse.Namespace) -> int:
         logger.debug("row[domain]='%s'", row["domain"])
         if not validators.domain(row["domain"].split("/")[0], rfc_2782=True):
             logger.info("Invalid row[domain]='%s' found, removing ...", row["domain"])
-            database.cursor.execute("DELETE FROM blocks WHERE blocker = ? OR blocked = ?", [row["domain"], row["domain"]])
-            database.cursor.execute("DELETE FROM instances WHERE domain = ? LIMIT 1", [row["domain"]])
+            blocks.delete(row["domain"])
+            instances.delete(row["domain"])
 
     logger.debug("Invoking commit() ...")
     database.connection.commit()
index d3e93a3a8ecd7f2a7ff868d98823044534218298..2ad3fd64f222dc82d3f530c63ff0e94c9f4fa81b 100644 (file)
@@ -280,8 +280,7 @@ def delete(domain: str) -> None:
     logger.debug("domain='%s' - CALLED!", domain)
     domain_helper.raise_on(domain)
 
-    database.cursor.execute(f"DELETE FROM blocks WHERE blocker = ?", [domain])
-    database.cursor.execute(f"DELETE FROM blocks WHERE blocked = ?", [domain])
+    database.cursor.execute(f"DELETE FROM blocks WHERE blocker = ? OR blocked = ?", [domain, domain])
 
     logger.debug("Invoking commit() ...")
     database.connection.commit()