diff options
Diffstat (limited to 'database.h')
-rw-r--r-- | database.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/database.h b/database.h index 83be73c..d9b2718 100644 --- a/database.h +++ b/database.h @@ -335,3 +335,13 @@ static inline void dbMigrate(void) { dbExec(MigrationSQL[version]); } } + +static inline void dbBackup(const char *path) { + if (sqlite3_libversion_number() < 3027000) { + errx(EX_CONFIG, "SQLite version 3.27.0 or newer required"); + } + sqlite3_stmt *stmt = dbPrepare(SQL(VACUUM INTO :path;)); + dbBindText(stmt, ":path", path); + dbRun(stmt); + sqlite3_finalize(stmt); +} |