-rw-r--r-- | src/iiidb.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/iiidb.h b/src/iiidb.h new file mode 100644 index 0000000..e77fa09 --- a/dev/null +++ b/src/iiidb.h | |||
@@ -0,0 +1,28 @@ | |||
1 | #ifndef __IIIDB_H | ||
2 | #define __IIIDB_H | ||
3 | |||
4 | #include <autosprintf.h> | ||
5 | #include "seclude.h" | ||
6 | #include "eyekinfig.h" | ||
7 | |||
8 | struct iiidb_t : public seclude::db_t { | ||
9 | iiidb_t(eyekinfig_t& k) : seclude::db_t(gnu::autosprintf("%s/.iii.db",k.get_targetdir().c_str())) { | ||
10 | try { | ||
11 | exec("SELECT 1 FROM photo LIMIT 0"); | ||
12 | }catch(const seclude::sqlite3_error& e) { | ||
13 | exec( "CREATE TABLE photo (" | ||
14 | " id integer PRIMARY KEY AUTOINCREMENT," | ||
15 | " ctime integer NOT NULL," | ||
16 | " mac text NOT NULL," | ||
17 | " fileid integer NOT NULL," | ||
18 | " filename text NOT NULL," | ||
19 | " filesize integer NOT NULL," | ||
20 | " filesignature text NOT NULL UNIQUE," | ||
21 | " encryption text NOT NULL," | ||
22 | " flags integer NOT NULL" | ||
23 | ")" ); | ||
24 | } | ||
25 | } | ||
26 | }; | ||
27 | |||
28 | #endif /* __IIIDB_H */ | ||