summaryrefslogtreecommitdiffabout
path: root/src/iiidb.h
Side-by-side diff
Diffstat (limited to 'src/iiidb.h') (more/less context) (show whitespace changes)
-rw-r--r--src/iiidb.h28
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 @@
+#ifndef __IIIDB_H
+#define __IIIDB_H
+
+#include <autosprintf.h>
+#include "seclude.h"
+#include "eyekinfig.h"
+
+struct iiidb_t : public seclude::db_t {
+ iiidb_t(eyekinfig_t& k) : seclude::db_t(gnu::autosprintf("%s/.iii.db",k.get_targetdir().c_str())) {
+ try {
+ exec("SELECT 1 FROM photo LIMIT 0");
+ }catch(const seclude::sqlite3_error& e) {
+ exec( "CREATE TABLE photo ("
+ " id integer PRIMARY KEY AUTOINCREMENT,"
+ " ctime integer NOT NULL,"
+ " mac text NOT NULL,"
+ " fileid integer NOT NULL,"
+ " filename text NOT NULL,"
+ " filesize integer NOT NULL,"
+ " filesignature text NOT NULL UNIQUE,"
+ " encryption text NOT NULL,"
+ " flags integer NOT NULL"
+ ")" );
+ }
+ }
+};
+
+#endif /* __IIIDB_H */