From: Roland Häder Date: Sun, 15 Sep 2024 10:23:43 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=eaa3c7ac6f6d87243472c22e5a14f35708a937bc;p=fba.git Continued: - these DELETE SQL statements have already been encapsulated --- diff --git a/fba/commands.py b/fba/commands.py index 091ac99..6726b02 100644 --- a/fba/commands.py +++ b/fba/commands.py @@ -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() diff --git a/fba/models/blocks.py b/fba/models/blocks.py index d3e93a3..2ad3fd6 100644 --- a/fba/models/blocks.py +++ b/fba/models/blocks.py @@ -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()