From 8cef826610f171b25a7a4aa3a764b1fb04c24d2f Mon Sep 17 00:00:00 2001 From: Michael Krelin Date: Tue, 29 Jan 2013 18:28:58 +0000 Subject: added persistent store for photo status Signed-off-by: Michael Krelin --- (limited to 'src/iiidb.h') 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 +#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 */ -- cgit v0.9.0.2