mirror of
https://github.com/YGGverse/flarumdown.git
synced 2026-03-31 08:45:28 +00:00
open DB with SQLITE_OPEN_READ_ONLY
This commit is contained in:
parent
c317362317
commit
0cbe2a7b04
1 changed files with 5 additions and 2 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
use chrono::{DateTime, Utc};
|
use chrono::{DateTime, Utc};
|
||||||
use rusqlite::{Connection, Error};
|
use rusqlite::{Connection, Error, OpenFlags};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
pub struct User {
|
pub struct User {
|
||||||
|
|
@ -34,7 +34,10 @@ pub struct Database(Connection);
|
||||||
|
|
||||||
impl Database {
|
impl Database {
|
||||||
pub fn connect(path: PathBuf) -> Result<Self, Error> {
|
pub fn connect(path: PathBuf) -> Result<Self, Error> {
|
||||||
Ok(Self(Connection::open(path)?))
|
Ok(Self(Connection::open_with_flags(
|
||||||
|
path,
|
||||||
|
OpenFlags::SQLITE_OPEN_READ_ONLY,
|
||||||
|
)?))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn users(&mut self) -> Result<Vec<User>, Error> {
|
pub fn users(&mut self) -> Result<Vec<User>, Error> {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue