Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Readonly connection

139 views
Skip to first unread message

ari.haus...@gmail.com

unread,
Jul 23, 2012, 3:37:53 PM7/23/12
to csharp...@googlegroups.com
Hi, I'm looking to to use this great project in a metro style app, and would like to open an already-created file as a read-only database. I have no problem opening it in general, but I'm unclear on how to make the connection read-only.

ari.haus...@gmail.com

unread,
Jul 23, 2012, 3:56:53 PM7/23/12
to csharp...@googlegroups.com
(As a note, I never intend to write to a database in this project, so changes to the source code that could affect all databases used are ok)

Stewart

unread,
Aug 21, 2012, 10:09:50 AM8/21/12
to csharp...@googlegroups.com, ari.haus...@gmail.com
Hi (unknown),

If you still need this.

Assuming that you are using the ADO.Net API to access the db, I've implemented the "Read Only" parameter (that the C++ implementation has) for this C# implementation.  You can test it using the code from this clone http://code.google.com/r/stewartadcock-csharp-sqlite-updates/ - it works for me with Mono on Mac OS X, and I assume it will work on Windows with .Net even though I haven't tested that yet.

To connect to a db in read-only mode, add "Read Only=True" to your connection string, and then connect as normal.  Any attempts to write to the db will fail.

I have also implemented the SQLite3 "FailIfMissing" parameter.  If set to true, sqlite will not create an empty db in the case that the specified uri doesn't exist.  This is also derived from the C++ version's parameter of the same name, to improve source-level compatibility.

Regards,
Stewart.
Reply all
Reply to author
Forward
0 new messages