summaryrefslogtreecommitdiffstats
path: root/src/database
diff options
context:
space:
mode:
authorHolger Cremer <HolgerCremer@gmail.com>2017-05-07 01:49:56 +0200
committerHolger Cremer <HolgerCremer@gmail.com>2017-05-07 01:49:56 +0200
commit789df3deba25d1feba82a171c01ce02e811ef52d (patch)
tree3ceb0099fa287360822841b1e1f761648aaa6364 /src/database
parent7d7da13042655b5b82b128f87ee5b7e8aa9a2715 (diff)
downloadserial-barcode-scanner-789df3deba25d1feba82a171c01ce02e811ef52d.tar.bz2
keeps the sound_theme value on user import (by using a sub select)
Diffstat (limited to 'src/database')
-rw-r--r--src/database/database.vala3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/database/database.vala b/src/database/database.vala
index 9596954..6bcbd70 100644
--- a/src/database/database.vala
+++ b/src/database/database.vala
@@ -121,7 +121,7 @@ public class DataBase : Object {
queries["total_sales"] = "SELECT SUM(price) FROM invoice WHERE user >= 0 AND timestamp >= ?";
queries["total_profit"] = "SELECT SUM(price - (SELECT price FROM purchaseprices WHERE product = productid)) FROM invoice WHERE user >= 0 AND timestamp >= ?";
queries["user_get_ids"] = "SELECT id FROM users WHERE id > 0";
- queries["user_replace"] = "INSERT OR REPLACE INTO users ('id', 'email', 'firstname', 'lastname', 'gender', 'street', 'plz', 'city', 'pgp', 'hidden', 'disabled') VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
+ queries["user_replace"] = "INSERT OR REPLACE INTO users ('id', 'email', 'firstname', 'lastname', 'gender', 'street', 'plz', 'city', 'pgp', 'hidden', 'disabled', 'sound_theme') VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, (select sound_theme from users where id = ?))";
queries["user_auth_create"] = "INSERT OR IGNORE INTO authentication (user) VALUES (?)";
queries["user_disable"] = "UPDATE users SET disabled = ? WHERE id = ?";
queries["last_timestamp"] = "SELECT timestamp FROM sales ORDER BY timestamp DESC LIMIT 1";
@@ -872,6 +872,7 @@ public class DataBase : Object {
statements["user_replace"].bind_text(9, u.pgp);
statements["user_replace"].bind_int(10, u.hidden ? 1 : 0);
statements["user_replace"].bind_int(11, u.disabled ? 1 : 0);
+ statements["user_replace"].bind_int(12, u.id);
int rc = statements["user_replace"].step();
if(rc != Sqlite.DONE)