diff options
author | Sebastian Reichel <sre@ring0.de> | 2012-05-24 14:57:32 +0200 |
---|---|---|
committer | Sebastian Reichel <sre@ring0.de> | 2012-05-24 14:57:32 +0200 |
commit | ff74ec3f5c466ae14f4fcb0128cecf14fa5cbf13 (patch) | |
tree | 25f809d2c293d96c8997449dc191fa23fa80548d | |
parent | 0032c6f0aad257bb0483e29054004cbc3632c49f (diff) | |
download | serial-barcode-scanner-ff74ec3f5c466ae14f4fcb0128cecf14fa5cbf13.tar.bz2 |
user ids are 2**31 max
-rw-r--r-- | db.vala | 6 | ||||
-rw-r--r-- | main.vala | 6 |
2 files changed, 6 insertions, 6 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; @@ -90,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, "%lld".printf(user)); this.purchase_stmt1.bind_text(2, "%llu".printf(article)); this.purchase_stmt1.bind_text(3, "%llu".printf(timestamp)); @@ -20,10 +20,10 @@ public static int main(string[] args) { public static bool interpret(string data) { if(data.has_prefix("USER ")) { string str_id = data.substring(5); - uint64 id = uint64.parse(str_id); + int32 id = int.parse(str_id); /* check if data has valid format */ - if(data != "USER %llu".printf(id)) { + if(data != "USER %lld".printf(id)) { stdout.printf("ungültige Benutzernummer: %s\n", data); return false; } @@ -33,7 +33,7 @@ public static bool interpret(string data) { db.logout(); } - stdout.printf("Login: %llu\n".printf(id)); + stdout.printf("Login: %lld\n".printf(id)); return db.login(id); } else if(data == "GUEST") { if(db.is_logged_in()) { |