Results 1 to 5 of 5

Thread: SQLite thread support

  1. #1
    Join Date
    Mar 2010
    Location
    Gdynia, Poland
    Posts
    12
    Thanked 3 Times in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default SQLite thread support

    Hi

    Does anybody know did SQLite driver shipped with Qt4 is build to have SQLITE_THREADSAFE=1 flag set during the compilation or not.
    If yes how to and where set SQLITE_THREADSAFE=2 to recompile with multit-hreded support instead serialized threads.

    Is there any possibility to use sqlite3_config( ... ) method re alter the thread support mode in Qt4.

    Regards

  2. #2
    Join Date
    May 2013
    Posts
    5
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default 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.

  3. #3
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default 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

  4. #4
    Join Date
    May 2013
    Posts
    5
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default 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).

  5. #5
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: SQLite thread support

    src/3rdparty/sqlite.pri after running a default configure (Qt 4.8.4 on Linux):
    Qt Code:
    1. CONFIG(release, debug|release):DEFINES *= NDEBUG
    2. DEFINES += SQLITE_OMIT_LOAD_EXTENSION SQLITE_OMIT_COMPLETE
    3. blackberry: DEFINES += SQLITE_ENABLE_FTS3 SQLITE_ENABLE_FTS3_PARENTHESIS SQLITE_ENABLE_RTREE
    4. wince*: DEFINES += HAVE_LOCALTIME_S=0
    5. INCLUDEPATH += $$PWD/sqlite
    6. SOURCES += $$PWD/sqlite/sqlite3.c
    To copy to clipboard, switch view to plain text mode 
    My money is on the default SQLITE_THREADSAFE = 1

Similar Threads

  1. Replies: 16
    Last Post: 7th October 2009, 09:17
  2. how to compile qtopia 2.2 with thread support
    By pencilren in forum Installation and Deployment
    Replies: 0
    Last Post: 6th August 2007, 14:06
  3. Thread support
    By kiranraj in forum Qt Programming
    Replies: 1
    Last Post: 9th March 2007, 09:32
  4. how to provide thread support to qt
    By amit_pansuria in forum Installation and Deployment
    Replies: 3
    Last Post: 24th November 2006, 05:48
  5. Problem building Qt4.1.0 with thread support on windows XP
    By pavithra in forum Installation and Deployment
    Replies: 1
    Last Post: 1st April 2006, 12:35

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.