On 29 May 2017 at 14:46, Clemens Ladisch <clem...@ladisch.de> wrote: > Howard Kapustein wrote: > > I'm effectively looking for a -readonly option, or how to achieve that > > net effect > > sqlite3 "file:test.db?mode=ro" > > But if you want to be really sure, set the file permissions to disallow > writes. (You have to except the -shm file, and this is not officially > supported, and it appears there is a delay due to a lock timeout > somewhere.) >
Note that there are some circumstances where sqlite _must_ be able write to the database even if you are only interested in reading data. Eg. in rollback journal mode, if a program crashes or you lose power partway through COMMIT the database is likely left in an inconsistent state. Sqlite resolves this next time the database is accessed by using information in the rollback journal to arrive back at a consistent state, which of course involves writing to the database to undo the partial COMMIT. It seems like a similar situation might arise in WAL mode if there's a crash/power failure during a checkpoint? But I'm not very familiar with WAL so forgive me if this is an irrelevant tangent. -Rowan _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users