[Interest] QSqlDatabase and threads

Lorenz Haas lykurg at gmail.com
Thu May 30 18:11:59 CEST 2013


AFAIK what you are trying is not possible:
http://qt-project.org/doc/qt-4.8/threads-modules.html#threads-and-the-sql-module

Best,
Lorenz

Am 30.05.2013 18:03, schrieb Witold E Wolski:
> I am using threading to speed up compuation. Each thread produces some
> results which I would like to store in a sqlite file.
> 
> My idea is to have something like an monitor object which has an
> QSqlDatabase member
> and a insert method which is synchronized using a mutex.
> 
> The problem I am  actually running into is that the QSqlDatabase member
> gets ??? once the pointer to the Monitor object is passed into to the
> threads.
> 
> 
> when asked in the thread it claims to be isOpen and to be isValid but all
> the inserts on it fail with
> 
> insert Feature: Parameter count mismatch
> 
> On the other hand if I construct the same object within the thread than
> everything works fine.
> So the instert statements are definitely correct.
> 
> Any ideas ? by the way I am using the tbb for threading.
> 
> Witold
> 
> 
> 
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
> 




More information about the Interest mailing list