mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-27 04:14:21 +00:00
More precise WALSnapshot creation errors
This commit is contained in:
1 parent
e430b4ebd7
commit
6295f4609e
1 file changed
+8
@@ -35,6 +35,14 @@ final class WALSnapshot: Sendable {
|
||||
return sqlite3_snapshot_get(db.sqliteConnection, "main", $0)
|
||||
}
|
||||
guard code == SQLITE_OK else {
|
||||
if sqlite3_get_autocommit(db.sqliteConnection) != 0 {
|
||||
throw DatabaseError(resultCode: code, message: "Can't create snapshot because database is in autocommit mode.")
|
||||
}
|
||||
if let journalMode = try? String.fetchOne(db, sql: "PRAGMA journal_mode"),
|
||||
journalMode != "wal"
|
||||
{
|
||||
throw DatabaseError(resultCode: code, message: "Can't create snapshot because database is not in WAL mode.")
|
||||
}
|
||||
throw DatabaseError(resultCode: code)
|
||||
}
|
||||
guard let sqliteSnapshot else {
|
||||
|
||||
Reference in new issue
Block a user