On domingo, 26 de janeiro de 2014 22:24:58, Igor Mironchik wrote:
> > No, that is not safe. You can use database access from threads, but
> > every thread needs it own QSqlDatabase instance of the database
> > connection. The documentation states:
> > "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."
> > (http://qt-project.org/doc/qt-4.8/threads-modules.html#threads-and-the-sql
> > -module)
> I will not use QSqlDatabase in another thread. I want to create
> QSqlDatabase connection in worker thread and execute queries in that
> thread... For SELECT statemetsa I want to return QSqlQuery object from
> worker thread to the GUI one. Is it safe to use QSqlQuery in another
> thread that created him?

Using QSqlAnything implies using the QSqlDatabase it's connected to. So you 
can't move QSqlQuery from one thread to another.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Interest mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to