Is it possible to connect to sqlite db memory in read-only memory?

I know that I can open several connections to the sqlite database in memory using file:DB_NAME?mode=memory&cache=sharedin sqlite3_open_v2().

I open 2 connections to the In-Memory database. One with flags SQLITE_OPEN_URI | SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE, and the other with SQLITE_OPEN_READONLY | SQLITE_OPEN_URI.

The problem is that sqlite allows me to modify the database, even if the connection is read-only.

Can I establish a read-only connection? Do I have to write my own VFS to execute it?

+4
source share
1 answer

SQLITE_OPEN_READONLY , .

. /.

, PRAGMA query_only.

+3

Source: https://habr.com/ru/post/1660484/


All Articles