On Sun, Oct 10, 2010 at 9:31 AM, Joshua Grauman <j...@grauman.com> wrote:

> I have a database that I want to be only read-only. I read in the
> optimization FAQ that this will make sqlite not create a journal and so
> run faster. I changed the permissions of my database file in Linux
> (removed the write permission), and sqlite was still able to create a new
> table. Since this file should never be written I also want to get an error
> if it is by some fault in a querry I write. So any ideas about how to make
> this entire database read-only? Is there a way to do this in sqlite
> itself? Thanks!
>
>

Did you try sqlite3_open_v2 with SQLITE_OPEN_READONLY flag?

Also if you're not content with this option, you can always open the file
(just as a general file) prior to sqlite with a "deny write" option. I'm
aware of such feature in Windows/Win32, I'm sure a similar option should
exist in Linux. In this case any attempt to write will lead to OS-level
error that finally will be passes as some sqlite error to your code.

Max Vlasov
maxerist.net
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to