haskell - How to open a Sqlite3 database in read-only mode with persistent? -


i use createsqlitepool persistent-sqlite:

import database.persist.sqlite  createsqlitepool "mydb.db" 10 

according sqlite3 documentation can pass additional parameters in connection strings, e.g.

"data source=c:\mydb.db;version=3;read only=true;" 

cf. https://www.connectionstrings.com/sqlite-net-provider/read-only-connection/

apparently, it's not possible pass connection string createsqlitepool. there way tell persistent-sqlite open database read-only?

i think that's .net specific information you're linking to, doesn't apply here.

if @ the code, persistent calls sqlite c function sqlite3_open takes filename of database.

it looks need use sqlite3_open_v2 take additional flags, if wanted make connection read-only.

you can achieve same thing using file permissions though, since user won't able write sqlite db file if don't have permission so.


Comments