I keep an SQLite database in the application container, but only ever read from it. The application never, ever, writes to the database.
Is there a way to set the database so that it is read only?
Or should I simply put the database in the SpecialFolder.ApplicationData folder that I have for the application?
Afaik there is no way to open an SQLite database as read-only from xojo. If you sandbox your app you won’t be able to read from it as long as it resides inside of your app container. Copy it to applicationData, as you already mentioned.
That’s what I usually do.
If you want only YOUR applicatino to read it (and potentially write to it)
add an encryption key that only you app is aware of.
That way no external application will be able to alter it…
Another suggestion (if on OSX) is use CHMOD to set the permissions to read only (although those can be changed externally)
[quote=280175:@Dave S]permissions can be changed with CHMOD and the lock can be removed with CHFLAG
not to mention both can be changed with “Get Info”[/quote]
You are correct. The locked flag is not meant to be a high-security system, it prevents accidental overwrite and delete. The way I interpreted the original request was not a high-security system.
Sometimes it helps to check how other application deals with what you want to do.
As far as I saw, one can open db from Xojo, Firefox, and probably many other applications. Now, reading the database does not means understanding the data base and the op was about writing.
Xojo, Firefox apparently does not care about a user write in one of their data base; honestly, an end user is capable of anything, but is theres a chance (or a bad luck) one will wrote into your db file ?