On Wed, Feb 20, 2008 at 04:50:47PM +0000, [EMAIL PROTECTED] wrote: > Private messages on this subject suggest that I have misunderstood > the question. What exactly do you mean by "instances" of SQLite?
Two instances of libsqlite3.a linked into different parts of the process. > If you create two or more connections (two or more calls to > sqlite3_open()) within the same process, they all share the same > st_dev hash table and hence they all know about each others locks. Understood. That's not the issue the poster had. The poster has two Apache modules, one PHP, the other a home-grown module, both accessing the same SQLite DB. If the poster follows your advice and statically links libsqlite3 in the relevant modules then they will have more than one instance of the SQLite3 object code in the same process. OTOH, I realize now that the linker should fail or warn about building dynamic shared objects that are statically linked with libsqlite3. So in the case of the poster I think it isn't possible to have two instances of SQLite in the same process. > If you create connections to the same databases from different > processes, then they don't share the same st_dev hash, but posix > advisory locking works in that case. Correct. > In either case you are covered. > > Even if you are accessing SQLite from two different languages, > you should only be linked against a single instance of the SQLite > library (otherwise you would get linkage errors) meaning that you > only have a single copy of the hash table. If you know of a way > to link two copies of the same library into the same process at > the same time, such that each copy of the library has its own > set of static variables, then the conditions above break down > and you cannot use SQLite safely. If one has an application (an executable, not a library) that is statically linked with SQLite *and* it uses an API with dynamic loading of plug-ins (e.g., GSS-API, PAM, SASL, ...) *and* a plug-in for that API uses SQLite, then you can have two instances in the same process. But presumably those instances would be used to access different databases. The app, after all, wouldn't have knowledge of the internals of any of those plug-ins. I.e., should be no problem. > But on the other hand, I don't > know of much software that is likely to survive such a scenario. > And I am unclear how such a scenario is even possible. Agreed. Nico -- _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users