[Qt-interest] QSqlDatabase in multi-threaded environment.
Scott Aron Bloom
Scott.Bloom at onshorecs.com
Fri Jun 3 20:56:50 CEST 2011
That is exactly what I do and it works well…
In general what I do is the following..
I name each thread, using setObjectName
Then I name the connection based on the thread name.
For each sql query, I get the appropriate sql connection.
Works like a charm
Scott
From: qt-interest-bounces+scott.bloom=onshorecs.com at qt.nokia.com [mailto:qt-interest-bounces+scott.bloom=onshorecs.com at qt.nokia.com] On Behalf Of BOUCARD Olivier
Sent: Friday, June 03, 2011 11:39 AM
To: Qt Interest
Subject: [Qt-interest] QSqlDatabase in multi-threaded environment.
Hi all,
My question is about QSqlDatabase and multi-thread.
In the documentation, I can see that "A connection can only be used from within the thread that created it", ok I can live with this.
But, do I have to name my database connection differently from each thread? Or the default connection will work as the QSqlDatabase::database function only see the connections created within the same thread?
Thank you for your answers.
Olivier.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110603/f032089c/attachment.html
More information about the Qt-interest-old
mailing list