diff options
| author | Anton <anton@picapica> | 2016-08-30 21:55:10 +0400 |
|---|---|---|
| committer | Anton <anton@picapica> | 2016-08-30 21:55:10 +0400 |
| commit | d2991d30b0062bfd2ad3ae272ccac8acf7a4997d (patch) | |
| tree | 78822437f5ae35ea31b31c4f09a967797822759b | |
| parent | bd74b5f2aef6e43a8060cfa1dd214f6797718008 (diff) | |
| download | pica-pica-d2991d30b0062bfd2ad3ae272ccac8acf7a4997d.tar.gz pica-pica-d2991d30b0062bfd2ad3ae272ccac8acf7a4997d.zip | |
added sqlite table settings and updated schema version
| -rw-r--r-- | pica-client/main.cpp | 27 |
1 files changed, 26 insertions, 1 deletions
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: { |
