@@ -60,6 +60,7 @@ impl FromStr for SqliteJournalMode {
60
60
pub struct SqliteConnectOptions {
61
61
pub ( crate ) filename : PathBuf ,
62
62
pub ( crate ) in_memory : bool ,
63
+ pub ( crate ) read_only : bool ,
63
64
pub ( crate ) journal_mode : SqliteJournalMode ,
64
65
pub ( crate ) foreign_keys : bool ,
65
66
pub ( crate ) statement_cache_capacity : usize ,
@@ -76,6 +77,7 @@ impl SqliteConnectOptions {
76
77
Self {
77
78
filename : PathBuf :: from ( ":memory:" ) ,
78
79
in_memory : false ,
80
+ read_only : false ,
79
81
foreign_keys : true ,
80
82
statement_cache_capacity : 100 ,
81
83
journal_mode : SqliteJournalMode :: Wal ,
@@ -99,6 +101,13 @@ impl SqliteConnectOptions {
99
101
self
100
102
}
101
103
104
+ /// Sets the [access mode](https://www.sqlite.org/c3ref/open.html) to open the database
105
+ /// for read-only access.
106
+ pub fn read_only ( mut self , read_only : bool ) -> Self {
107
+ self . read_only = read_only;
108
+ self
109
+ }
110
+
102
111
/// Sets the capacity of the connection's statement cache in a number of stored
103
112
/// distinct statements. Caching is handled using LRU, meaning when the
104
113
/// amount of queries hits the defined limit, the oldest statement will get
0 commit comments