diff options
| author | Martin Stensgård <mastensg@mastensg.net> | 2026-05-16 22:12:46 +0200 |
|---|---|---|
| committer | Martin Stensgård <mastensg@mastensg.net> | 2026-05-16 22:12:46 +0200 |
| commit | a4a15001601ba9a1a32b64dec3ad079114d1be2f (patch) | |
| tree | 40ec76d56d4a0e82c54a38bb90f38cacc4a1c287 /opplysning-vis.c | |
| parent | b60defef95ebad4d78a8cf98bf8c74694fbc7163 (diff) | |
sqlite for servers
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), " |
