aboutsummaryrefslogtreecommitdiff
path: root/libdino/src/entity/settings.vala
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2020-06-10 23:40:00 +0200
committerfiaxh <git@lightrise.org>2020-06-10 23:40:00 +0200
commit0beb592c5a6a2767e11a892bdb5ac9bcc5283c38 (patch)
treebea2894d322472292590ec126dc1b52543a10a7e /libdino/src/entity/settings.vala
parent50c55c7f55aff6622d242bdcf2b58d5f7956f28e (diff)
downloaddino-0beb592c5a6a2767e11a892bdb5ac9bcc5283c38.tar.gz
dino-0beb592c5a6a2767e11a892bdb5ac9bcc5283c38.zip
Use sqlite UPSERT
Diffstat (limited to 'libdino/src/entity/settings.vala')
-rw-r--r--libdino/src/entity/settings.vala20
1 files changed, 16 insertions, 4 deletions
diff --git a/libdino/src/entity/settings.vala b/libdino/src/entity/settings.vala
index bf1ebed4..2aae6055 100644
--- a/libdino/src/entity/settings.vala
+++ b/libdino/src/entity/settings.vala
@@ -22,7 +22,10 @@ public class Settings : Object {
public bool send_typing {
get { return send_typing_; }
set {
- db.settings.insert().or("REPLACE").value(db.settings.key, "send_typing").value(db.settings.value, value.to_string()).perform();
+ db.settings.upsert()
+ .value(db.settings.key, "send_typing", true)
+ .value(db.settings.value, value.to_string())
+ .perform();
send_typing_ = value;
}
}
@@ -31,7 +34,10 @@ public class Settings : Object {
public bool send_marker {
get { return send_marker_; }
set {
- db.settings.insert().or("REPLACE").value(db.settings.key, "send_marker").value(db.settings.value, value.to_string()).perform();
+ db.settings.upsert()
+ .value(db.settings.key, "send_marker", true)
+ .value(db.settings.value, value.to_string())
+ .perform();
send_marker_ = value;
}
}
@@ -40,7 +46,10 @@ public class Settings : Object {
public bool notifications {
get { return notifications_; }
set {
- db.settings.insert().or("REPLACE").value(db.settings.key, "notifications").value(db.settings.value, value.to_string()).perform();
+ db.settings.upsert()
+ .value(db.settings.key, "notifications", true)
+ .value(db.settings.value, value.to_string())
+ .perform();
notifications_ = value;
}
}
@@ -49,7 +58,10 @@ public class Settings : Object {
public bool convert_utf8_smileys {
get { return convert_utf8_smileys_; }
set {
- db.settings.insert().or("REPLACE").value(db.settings.key, "convert_utf8_smileys").value(db.settings.value, value.to_string()).perform();
+ db.settings.upsert()
+ .value(db.settings.key, "convert_utf8_smileys", true)
+ .value(db.settings.value, value.to_string())
+ .perform();
convert_utf8_smileys_ = value;
}
}