diff --git a/lib/Database.php b/lib/Database.php index df58aec..de5342d 100644 --- a/lib/Database.php +++ b/lib/Database.php @@ -3,13 +3,18 @@ class Database { public static $handle = null; - public function __construct($createDatabase = false) + public function __construct($createDatabase = false, bool $readonly = false) { if (self::$handle === null) { self::$handle = new SQLite3(SQLITE_DB); self::$handle->enableExceptions(true); self::$handle->busyTimeout(60000); + if ($readonly === true) { + self::$handle->exec("PRAGMA read_uncommitted = true"); + return; + } + $initialQueries = [ "PRAGMA journal_mode = WAL", "PRAGMA synchronous = OFF",