I have public interface which allows people to interact with the database by typing in sql commands. However, I do not want them to change the database in any way (and if possible, not access certain tables). As I understand though, SQLite has no concept of users, so how do I accomplish this?
I have public interface which allows people to interact with the database by typing
Share
Copy the “master” database file first and open that 🙂 No, really, this is a serious suggestion.
Otherwise, depending on how SQLite is accessed, the SQLITE_OPEN_READONLY flag that can be passed to
sqlite3_open_v2. This applies to the entire connection — and all transactions on that connection.Another option is to limit the SQL entry, but this is very very hard to do correctly and thus I don’t recommend this route.
Happy coding.