-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 10/10/2010 11:53 AM, Max Vlasov wrote: > 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.
Actually Linux/Unix does not have such deny mode options. Additionally locking is cooperative not mandatory. There are two reasons for this. Historically Unix has always been multi-user and having the ability to deny other users/programs access to a file that they have permissions for would cause far more harm than good. The second is that system data has traditionally been stored in plain text files - things like /etc/hosts for name to IP address mappings and /etc/passwd for the user password database. If any program could deny access to those for any other program/user then it would be a trivial denial of service attack. See the Unix Hater's Guide (free PDF online) for more details of Unix locking. Going back to Joshua's original question, by default a SQLite database is not read-only even if you think it is. The major reason is that even if you wanted to use it read-only, the previous program may have had it open for writing, and may have crashed in the middle of a transaction. Consequently the reader needs to fix the database using the journal to get it back into a correct state which involves writing. Heck even while you have it open and idle, a writer could have started a transaction and crashed requiring recovery. Roger -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkyyDkQACgkQmOOfHg372QQEGQCcDEK20d0jgCe1YfGLMxTT7erc 4tAAn0HBEZhM1rFpot6K+ORNTMquyZyo =iHyP -----END PGP SIGNATURE----- _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users