From d2991d30b0062bfd2ad3ae272ccac8acf7a4997d Mon Sep 17 00:00:00 2001 From: Anton Date: Tue, 30 Aug 2016 21:55:10 +0400 Subject: added sqlite table settings and updated schema version --- pica-client/main.cpp | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'pica-client') diff --git a/pica-client/main.cpp b/pica-client/main.cpp index 7df81ce..fcfa3c1 100644 --- a/pica-client/main.cpp +++ b/pica-client/main.cpp @@ -135,7 +135,17 @@ static bool create_database() if (query.lastError().isValid()) goto showerror; - query.exec("insert into schema_version values (2, strftime('%s','now'));"); //current schema version. update when needed + query.exec("create table settings \ + ( \ + name varchar(255) not null, \ + value varchar(255) not null \ + );" + ); + + if (query.lastError().isValid()) + goto showerror; + + query.exec("insert into schema_version values (3, strftime('%s','now'));"); //current schema version. update when needed if (query.lastError().isValid()) showerror: @@ -363,6 +373,21 @@ static bool update_database() schema_ver = 2; } + if (schema_ver == 2) + { + query.exec("create table settings \ + ( \ + name varchar(255) not null, \ + value varchar(255) not null \ + );" + ); + + if (query.lastError().isValid()) + goto showerror; + + schema_ver = 3; + } + if (query.lastError().isValid()) showerror: { -- cgit v1.2.1