Adds comment deletion query
This commit is contained in:
parent
966917532d
commit
19fce5f1b4
1 changed files with 8 additions and 0 deletions
|
@ -156,6 +156,14 @@ def get_comments_by_id(conn, comment_ids: list) -> typing.Union[list, None]:
|
||||||
)]
|
)]
|
||||||
|
|
||||||
|
|
||||||
|
def delete_comment_by_id(conn: sqlite3.Connection, comment_id: str):
|
||||||
|
with conn:
|
||||||
|
if conn.execute('SELECT 1 FROM COMMENT WHERE CommentId = ? LIMIT 1', (comment_id,)).fetchone():
|
||||||
|
conn.execute("DELETE FROM COMMENT WHERE CommentId = ?", (comment_id,))
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
class DatabaseWriter(object):
|
class DatabaseWriter(object):
|
||||||
_writer = None
|
_writer = None
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue