Reputation: 83
From the SQLite documentation article on multithreading I get that in Multi-thread mode "SQLite can be safely used by multiple threads provided that no single database connection is used simultaneously in two or more threads".
It doesn't explain though: exactly what is unsafe to do simultaneously in two or more threads in this mode? Apart from the obvious CREATE, INSERT, UPDATE, DROP etc. queries modifying the database,
And what about using statements (sqlite3_stmt)? Is it also unsafe to simultaneously use them if they are connected with the same database? Especially:
Upvotes: 0
Views: 1210
Reputation: 26569
From my understanding, any operation on the sqlite3
object from two or more threads at the same time is dangerous in multi-threaded mode. Same applies to sqlite3_stmt
objects, since they are "part of" the sqlite3
object.
However, you can (and usually do) have more than one sqlite3
connection to the same database, even in different processes. SQLite will manage concurrency between them.
Upvotes: 1