2 * add a file/files to an sqlite db
3 * in the 'files' table.
18 static int callback(void *NotUsed, int argc, char **argv, char **azColName){
20 for(i=0; i<argc; i++){
21 printf("%s = %s\n", azColName[i], argv[i] ? argv[i] : "NULL");
28 static char *create_table = "create table if not exists files (hash text primary key, size integer, compression text, content blob)";
37 #define SQLERROR(x) fprintf(stderr, "%s %d: %s\n", __func__, __LINE__, (x))
38 int begin(sqlite3 *db) {
42 rc = sqlite3_exec(db, "begin;", callback, 0, &err);
43 if (rc != SQLITE_OK) {
50 int commit(sqlite3 *db) {
54 rc = sqlite3_exec(db, "commit;", callback, 0, &err);
55 if (rc != SQLITE_OK) {
62 int rollback(sqlite3 *db) {
66 rc = sqlite3_exec(db, "rollback;", callback, 0, &err);
67 if (rc != SQLITE_OK) {