[Qt-interest] Re : QSqlDatabase in multi-threaded environment.
BOUCARD Olivier
boucard_olivier at yahoo.fr
Sat Jun 4 09:50:43 CEST 2011
Ok. Thank you. I will do the same.
>________________________________
>De : Scott Aron Bloom <Scott.Bloom at onshorecs.com>
>À : BOUCARD Olivier <boucard_olivier at yahoo.fr>; Qt Interest <qt-interest at trolltech.com>
>Envoyé le : Vendredi 3 Juin 2011 20h56
>Objet : RE: [Qt-interest] QSqlDatabase in multi-threaded environment.
>
>
>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/20110604/8f9ef9c6/attachment.html
More information about the Qt-interest-old
mailing list