diff options
Diffstat (limited to 'opplysning-vis.c')
| -rw-r--r-- | opplysning-vis.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/opplysning-vis.c b/opplysning-vis.c index 564de5d..9954630 100644 --- a/opplysning-vis.c +++ b/opplysning-vis.c @@ -56,10 +56,21 @@ struct calendar { void load_events(struct calendar *cal) { - sqlite3 *db; + sqlite3 *db = NULL; + char *errmsg = NULL; + if (sqlite3_open(cal->database, &db)) errx(1, "sqlite3_open: %s", sqlite3_errmsg(db)); + if (sqlite3_exec(db, + "PRAGMA journal_mode = WAL;" + "PRAGMA synchronous = NORMAL;" + "PRAGMA foreign_keys = true;" + "PRAGMA busy_timeout = 5000;" + "", + NULL, NULL, &errmsg)) + errx(1, "sqlite3_exec: %s", errmsg); + const char *sql = "SELECT " "unixepoch(start), " "unixepoch(end), " |
