Re: [Cppcms-users] Threaded access to SQLite
Brought to you by:
artyom-beilis
From: Artyom B. <art...@gm...> - 2017-01-10 06:56:41
|
> On Sun, Jan 8, 2017 at 12:17 AM, Artyom Beilis wrote: >> In general sqlite3 behaves poorly with multiple threads and you should >> make yourself ready to deal with the issue - simultanious updates and >> even query + update may fail. >> >> Artyom > > Currently the cppdb_sqlite3 driver attempts to open a new > connection to the database via sqlite3_open_v2() for each thread. > >From the SQLite documentation, it would seem that a given process > should only have one shared connection to the database. If that > is the case, then the cppdb_sqlite3 driver is written contrary to > the intended usage of sqlite3. It seems that the right thing to > do may be to open a single connection and share it between the > threads. > You are wrong, sqlite3 fully supports multi-threading but you need to be sure that you are using the sqlite3 library that was compiled properly. https://www.sqlite.org/threadsafe.html Artyom |