On 1/29/15, Duquette, William H (393K) <william.h.duque...@jpl.nasa.gov> wrote:
> Howdy!
>
> I've got an object that encapsulates access to an SQLite database, i.e., all
> writes to the database are done in terms of method calls to the object.
> However, I want to give the application read-only access to the database for
> queries.  There are two obvious ways to do this:
>
> 1. I can define an "authorizer", and have it deny write access for queries
> coming from outside the object.
>
> 2. I can open two database handles on the one file, one of them read-only,
> and give the outside application access to the read-only database handle.
>
> At present the application is single-threaded, so simultaneous access isn't
> an issue (and I'm using WAL mode anyway).
>
> I'm currently using #1; I enable the authorizer before queries from outside,
> and remove it afterward, each time.
>
> I kind of like #2--it's simpler--but I'm worried that it would increase
> memory usage considerably.
>

I vote for #2.  Measure the memory usage if that is a concern.

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

Reply via email to