diff options
author | Louie S <louie@example.com> | 2023-09-16 09:36:14 -0400 |
---|---|---|
committer | Louie S <louie@example.com> | 2023-09-16 09:36:14 -0400 |
commit | 7b680d73f75dfc0f0c057e948994159ed055073a (patch) | |
tree | c8b0ec1bb61f7be97cef715681d6343fee872743 /db_sqlite.py | |
parent | 11db353ea4cac33caccb005be7d4b72671f20ad9 (diff) |
Edit/update group information
Diffstat (limited to 'db_sqlite.py')
-rw-r--r-- | db_sqlite.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/db_sqlite.py b/db_sqlite.py index a3620e2..deef984 100644 --- a/db_sqlite.py +++ b/db_sqlite.py @@ -170,6 +170,30 @@ def insertEntry(new_entry): return output +def updateGroup(group): + """ + Update group by group_id + """ + 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() + + query.prepare(""" + UPDATE groups SET name = ?, column = ?, link = ? WHERE id = ? + """) + query.addBindValue(group.name) + query.addBindValue(group.column) + query.addBindValue(group.link) + query.addBindValue(group.id) + query.exec_() + + database.close() + def removeGroup(group_id): """ Remove a group by id from the database |