Confirm DB cleansing.
Signed-off-by: Arun Prakash Jana <engineerarun@gmail.com>
This commit is contained in:
parent
a75a56cd5a
commit
366b493ca0
6
buku
6
buku
@ -344,8 +344,14 @@ def searchdb(cur, keywords):
|
|||||||
# Delete a single record or remove the table
|
# Delete a single record or remove the table
|
||||||
def cleardb(conn, cur, index):
|
def cleardb(conn, cur, index):
|
||||||
if index == None: # Remove the table
|
if index == None: # Remove the table
|
||||||
|
resp = input("ALL bookmarks will be removed. Enter \x1b[1my\x1b[21m to confirm: ")
|
||||||
|
if resp != 'y':
|
||||||
|
print("No bookmarks deleted")
|
||||||
|
return
|
||||||
|
|
||||||
cur.execute('DROP TABLE if exists bookmarks')
|
cur.execute('DROP TABLE if exists bookmarks')
|
||||||
conn.commit()
|
conn.commit()
|
||||||
|
print("All bookmarks deleted")
|
||||||
else: # Remove a single entry
|
else: # Remove a single entry
|
||||||
try:
|
try:
|
||||||
cur.execute("DELETE FROM bookmarks WHERE id = ?", (int(index),))
|
cur.execute("DELETE FROM bookmarks WHERE id = ?", (int(index),))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user