A second response to this issue orf read-only. For my program the user will 
never directly the database. The user will make selections from the program and 
then the program will query the database. The user will then see how many 
records remain in the database and make selections from other portions of the 
program. The program will then query the database again. In other words, the 
database will be read-only if the user does not really have direct access to 
the database through the program. Does this make sense?
 
BobK

--- On Sun, 10/10/10, Max Vlasov <max.vla...@gmail.com> wrote:


From: Max Vlasov <max.vla...@gmail.com>
Subject: Re: [sqlite] Create Read-only Database
To: "General Discussion of SQLite Database" <sqlite-users@sqlite.org>
Date: Sunday, October 10, 2010, 1:53 PM


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



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

Reply via email to