summaryrefslogtreecommitdiff
path: root/db_sqlite.py
diff options
context:
space:
mode:
Diffstat (limited to 'db_sqlite.py')
-rw-r--r--db_sqlite.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/db_sqlite.py b/db_sqlite.py
index deef984..01f771d 100644
--- a/db_sqlite.py
+++ b/db_sqlite.py
@@ -223,4 +223,31 @@ def removeGroup(group_id):
query.addBindValue(group_id)
query.exec_()
+ output = query.numRowsAffected()
database.close()
+ return output
+
+def removeEntry(entry_id):
+ """
+ Remove a group by id from the database
+ (actually set hidden to true, don't permanently delete it)
+ """
+ database = QSqlDatabase.addDatabase("QSQLITE") # SQlite version 3
+ database.setDatabaseName(Globals.db_path)
+
+ if not database.open():
+ print("Unable to open data source file.")
+ sys.exit(1) # Error out. TODO consider throwing a dialog instead
+
+ query = QSqlQuery()
+
+ # Set entry to hidden
+ query.prepare("""
+ UPDATE entries SET hidden = 1 WHERE id = ?
+ """)
+ query.addBindValue(entry_id)
+ query.exec_()
+
+ output = query.numRowsAffected()
+ database.close()
+ return output