summaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/db_sqlite.cpp30
-rw-r--r--src/backend/db_sqlite.h2
2 files changed, 31 insertions, 1 deletions
diff --git a/src/backend/db_sqlite.cpp b/src/backend/db_sqlite.cpp
index 763fba5..0d21a05 100644
--- a/src/backend/db_sqlite.cpp
+++ b/src/backend/db_sqlite.cpp
@@ -218,6 +218,36 @@ void BackendDB::updateGroup(const Group &group) {
QSqlDatabase::removeDatabase("qt_sql_default_connection");
}
+void BackendDB::updateEntry(const Entry &entry) {
+ {
+ QSqlDatabase database(this->openDB());
+ QSqlQuery query;
+
+ query.prepare("UPDATE entries SET "
+ "description = :desc, "
+ "due_date = :due, "
+ "alt_due_date = :alt_due, "
+ "link = :link, "
+ "color = :color, "
+ "highlight = :highlight, "
+ "done = :done, "
+ "hidden = :hidden "
+ "WHERE id = :id");
+ query.bindValue(":desc", entry.desc);
+ query.bindValue(":due", entry.due.toString("yyyy-MM-dd"));
+ query.bindValue(":alt_due", entry.due_alt);
+ query.bindValue(":link", entry.link);
+ query.bindValue(":color", entry.color);
+ query.bindValue(":highlight", entry.highlight);
+ query.bindValue(":done", entry.done);
+ query.bindValue(":hidden", entry.hidden);
+ query.bindValue(":id", entry.id);
+ query.exec();
+ }
+
+ QSqlDatabase::removeDatabase("qt_sql_default_connection");
+}
+
// hide group and entries belonging to group
// return value: number of affected rows
int BackendDB::removeGroup(const Group &group) {
diff --git a/src/backend/db_sqlite.h b/src/backend/db_sqlite.h
index c2e8ac7..83b36f9 100644
--- a/src/backend/db_sqlite.h
+++ b/src/backend/db_sqlite.h
@@ -20,7 +20,7 @@ class BackendDB : QSqlDatabase {
int insertEntry(const Entry &new_entry);
int insertRule(int new_rule); // param datatype TBD
void updateGroup(const Group &group);
- void updateEntry(int entry); // param datatype TBD
+ void updateEntry(const Entry &entry); // param datatype TBD
void updateRule(int rule); // param datatype TBD
int removeGroup(const Group &group);
void removeEntry(int entry); // param datatype TBD