diff options
author | Lennart Weller <lhw@ring0.de> | 2012-05-30 13:22:26 +0200 |
---|---|---|
committer | Lennart Weller <lhw@ring0.de> | 2012-05-30 13:22:26 +0200 |
commit | eb436c2367f46d75d9f0aee4f27685927b30da00 (patch) | |
tree | a58d3e8cdd625263cbfc86a481384647ddfcb707 /db.vala | |
parent | d0662a530aca84dd41b68c0f2bfe07dd6a27e78d (diff) | |
parent | fc63c191fddb2d58ac845f4be27097c2431b5656 (diff) | |
download | serial-barcode-scanner-eb436c2367f46d75d9f0aee4f27685927b30da00.tar.bz2 |
Merge branch 'master' into eventbased
Diffstat (limited to 'db.vala')
-rw-r--r-- | db.vala | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -8,7 +8,7 @@ public class Database { private Sqlite.Statement undo_stmt3; private Sqlite.Statement stock_stmt1; private Sqlite.Statement stock_stmt2; - uint64 user = 0; + int32 user = 0; uint64 product = 0; bool logged_in = false; bool stock_mode = false; @@ -71,7 +71,7 @@ public class Database { } - public bool login(uint64 id) { + public bool login(int32 id) { this.user = id; this.logged_in = true; return true; @@ -79,6 +79,7 @@ public class Database { public bool logout() { this.user = 0; + this.stock_mode = false; this.logged_in = false; return true; } @@ -89,7 +90,7 @@ public class Database { int64 timestamp = (new DateTime.now_utc()).to_unix(); this.purchase_stmt1.reset(); - this.purchase_stmt1.bind_text(1, "%llu".printf(user)); + this.purchase_stmt1.bind_text(1, "%d".printf(user)); this.purchase_stmt1.bind_text(2, "%llu".printf(article)); this.purchase_stmt1.bind_text(3, "%llu".printf(timestamp)); @@ -132,7 +133,7 @@ public class Database { int rc = 0; this.undo_stmt1.reset(); - this.undo_stmt1.bind_text(1, "%llu".printf(user)); + this.undo_stmt1.bind_text(1, "%d".printf(user)); rc = this.undo_stmt1.step(); switch(rc) { @@ -140,14 +141,14 @@ public class Database { pid = uint64.parse(this.undo_stmt1.column_text(0)); break; case Sqlite.DONE: - stdout.printf("undo not possible without purchases"); + stdout.printf("undo not possible without purchases\n"); return false; default: error("[interner Fehler: %d]".printf(rc)); } this.undo_stmt2.reset(); - this.undo_stmt2.bind_text(1, "%llu".printf(user)); + this.undo_stmt2.bind_text(1, "%d".printf(user)); rc = this.undo_stmt2.step(); if(rc != Sqlite.DONE) @@ -180,7 +181,7 @@ public class Database { int64 timestamp = (new DateTime.now_utc()).to_unix(); this.stock_stmt1.reset(); - this.stock_stmt1.bind_text(1, "%llu".printf(user)); + this.stock_stmt1.bind_text(1, "%d".printf(user)); this.stock_stmt1.bind_text(2, "%llu".printf(product)); this.stock_stmt1.bind_text(3, "%llu".printf(amount)); this.stock_stmt1.bind_text(4, "%llu".printf(timestamp)); |