i was wondering if it possible to access SQLite dbs in read only mode ? on desktop or iOS.
the purpose is to have two apps : one is the editor, and a simple client is only a readonly. in postgres or mysql you can have users privileges, but on local desktop ?
i see on the doc some alert :
5 Database is locked
6 Database table is locked
8 Attempt to write a read/only database
but i guess this is for web or local unix users that don’t have write permissions
and on iOS is it possible that two apps share the same db ?
you supply the encryption key during the connection sequence… and once connected, everything works exactly the same as if it were never encrypted… you can change anything
Nothing wrong with a database you can only READ from.
Consider a database on a CD…
SQLLite doesnt have the concept of users and permissions.
So if you want one user to be able to write, and another only to be able to read, you might try setting sharing permissions on the folder where the database resides.
Your user has full acces.
“Everyone” has read-only
This assumes that SQLLite doesnt try to write something into the database to record an active session.
And you probably have no similar options in iOS.
That said, you could ship a read-only and a read-write version of your app, with the absence of write actions coded into the business logic.
Also note: in theory one can open a sqlite database file in readonly mode, but this is not available in the Xojo SQLiteDatabase class. This is why the temporary log files are always created, even in a case where one has no intention to write, but only to select data. A major hassle for sandboxed apps on macOS…
in the Read Only application, just below the code that let the user to select a sqlite file, (check if the file Locked is true; if false:) use FolderItem.Locked ( FolderItem.Locked to true (example code there), and set it to false on quit (load another file), whatever.
And if your applications does not know the .sqlite file Locked status, you can check it at Open time, store the status and restore the original one before left the .sqlite (either selecting another fie or applciation quit).
These are clues, you will do things how you feel is the best for what your application do.