Re: SQLite thread support
There was no answer for long time, but the question is also important for me.
It seems that if no precompiler definitions are made during compilation of library, SQLITE_THREADSAFE will be set to 1, but I want to know it for sure.
Re: SQLite thread support
But for what. From Qt doc : A connection can only be used from within the thread that created it. Moving connections between threads or creating queries from a different thread is not supported. In addition, the third party libraries used by the QSqlDrivers can impose further restrictions on using the SQL Module in a multithreaded program. Consult the manual of your database client for more information
Re: SQLite thread support
Of course, this point from documentation is important. I'd want to know what happens when you create different connections in different threads and try to simultaneously perform read and write operations over database. Server-based installations like PostgreSQL and others have documented rules of multithreaded access, as SQLite does too. Though there still is an ambiguity as Qt's documentation does not cover what preprocessor definitions were used to build the SQLite driver. More specifically, what value of SQLITE_THREADSAFE was used, 0, 1, or 2, or was it left default (which is 1 that enables all mutexes).
Re: SQLite thread support
src/3rdparty/sqlite.pri after running a default configure (Qt 4.8.4 on Linux):
Code:
CONFIG(release, debug|release):DEFINES *= NDEBUG
DEFINES += SQLITE_OMIT_LOAD_EXTENSION SQLITE_OMIT_COMPLETE
blackberry: DEFINES += SQLITE_ENABLE_FTS3 SQLITE_ENABLE_FTS3_PARENTHESIS SQLITE_ENABLE_RTREE
wince*: DEFINES += HAVE_LOCALTIME_S=0
INCLUDEPATH += $$PWD/sqlite
SOURCES += $$PWD/sqlite/sqlite3.c
My money is on the default SQLITE_THREADSAFE = 1