From 0cbe2a7b0483d9dec97f410d56b21bd3c4526853 Mon Sep 17 00:00:00 2001 From: yggverse Date: Fri, 20 Mar 2026 00:03:36 +0200 Subject: [PATCH] open DB with SQLITE_OPEN_READ_ONLY --- src/database.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/database.rs b/src/database.rs index d82981d..6325b12 100644 --- a/src/database.rs +++ b/src/database.rs @@ -1,5 +1,5 @@ use chrono::{DateTime, Utc}; -use rusqlite::{Connection, Error}; +use rusqlite::{Connection, Error, OpenFlags}; use std::path::PathBuf; pub struct User { @@ -34,7 +34,10 @@ pub struct Database(Connection); impl Database { pub fn connect(path: PathBuf) -> Result { - Ok(Self(Connection::open(path)?)) + Ok(Self(Connection::open_with_flags( + path, + OpenFlags::SQLITE_OPEN_READ_ONLY, + )?)) } pub fn users(&mut self) -> Result, Error> {