From faf08512694fbf74af536b913005e17f102d957d Mon Sep 17 00:00:00 2001 From: Oleg Silkin Date: Fri, 9 Aug 2019 06:58:26 -0400 Subject: [PATCH] Fixes syntax for compatibility with sqlite 3.22 --- src/database/queries.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/database/queries.py b/src/database/queries.py index b4e2dd1..2b66815 100644 --- a/src/database/queries.py +++ b/src/database/queries.py @@ -82,11 +82,11 @@ def get_claim_comments(conn: sqlite3.Connection, claim_id: str, parent_id: str = def get_claim_hidden_comments(conn: sqlite3.Connection, claim_id: str, hidden=True, page=1, page_size=50): with conn: results = conn.execute( - SELECT_COMMENTS_ON_CLAIMS + "WHERE claim_id = ? AND is_hidden = ? LIMIT ? OFFSET ?", + SELECT_COMMENTS_ON_CLAIMS + "WHERE claim_id = ? AND is_hidden IS ? LIMIT ? OFFSET ?", (claim_id, hidden, page_size, page_size * (page - 1)) ) count = conn.execute( - "SELECT COUNT(*) FROM COMMENTS_ON_CLAIMS WHERE claim_id = ? AND is_hidden = ?", (claim_id, hidden) + "SELECT COUNT(*) FROM COMMENTS_ON_CLAIMS WHERE claim_id = ? AND is_hidden IS ?", (claim_id, hidden) ) results = [clean(dict(row)) for row in results.fetchall()] count = tuple(count.fetchone())[0] @@ -104,7 +104,7 @@ def get_claim_hidden_comments(conn: sqlite3.Connection, claim_id: str, hidden=Tr def claim_has_hidden_comments(conn, claim_id): with conn: result = conn.execute( - "SELECT COUNT(DISTINCT is_hidden) FROM COMMENTS_ON_CLAIMS WHERE claim_id = ? AND is_hidden = TRUE", + "SELECT COUNT(DISTINCT is_hidden) FROM COMMENTS_ON_CLAIMS WHERE claim_id = ? AND is_hidden IS TRUE", (claim_id,) ) return bool(tuple(result.fetchone())[0])