-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSQLdelete.py
27 lines (20 loc) · 872 Bytes
/
SQLdelete.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import SQLmain
# DELETE
# deleteSubject(subjectID: int) -> void?
# deleteURLs(subjectID: int, url: str)
# deleteAllURLs(subjectID: int)
# deleteZoom(subjectID: int)
# note: you might have to conn.commit
# def deleteSubject(subjectID: int):
def deleteAllURLs(subjectID: int):
SQLmain.cur.execute("DELETE FROM urls WHERE subject_id = ?", (subjectID,))
SQLmain.conn.commit()
def deleteSubjectUrl(subjectID: int, url: str):
SQLmain.cur.execute("DELETE FROM urls WHERE subject_id = ? AND url = ?", (subjectID, url))
SQLmain.conn.commit()
# beware this one
def deleteSubject(subjectID: int):
SQLmain.cur.execute("DELETE FROM aliases WHERE subject_id = ?", (subjectID,))
SQLmain.cur.execute("DELETE FROM urls WHERE subject_id = ?", (subjectID,))
SQLmain.cur.execute("DELETE FROM subjects WHERE id = ?", (subjectID,))
SQLmain.conn.commit()