From a4a15001601ba9a1a32b64dec3ad079114d1be2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Stensg=C3=A5rd?= Date: Sat, 16 May 2026 22:12:46 +0200 Subject: sqlite for servers --- opplysning-vis.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'opplysning-vis.c') 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), " -- cgit v1.2.3