author | Michael Krelin <hacker@klever.net> | 2013-01-29 18:28:58 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2013-02-02 12:42:52 (UTC) |
commit | 8cef826610f171b25a7a4aa3a764b1fb04c24d2f (patch) (side-by-side diff) | |
tree | 0f4cd74156e998931955c9117fb263a37ba1f98c /src/iiidb.h | |
parent | 7e4f9ebf4a76de3adafba6b32620d4610341897b (diff) | |
download | iii-8cef826610f171b25a7a4aa3a764b1fb04c24d2f.zip iii-8cef826610f171b25a7a4aa3a764b1fb04c24d2f.tar.gz iii-8cef826610f171b25a7a4aa3a764b1fb04c24d2f.tar.bz2 |
added persistent store for photo status
Signed-off-by: Michael Krelin <hacker@klever.net>
-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 @@ +#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 */ |