[Interest] SQL databases and threading

Andrew Ialacci andrew at dkai.dk
Fri Oct 12 08:56:04 CEST 2018

It is not. You should create a QObject, move that to a thread, and then work with the query inside the thread inside the QObject.

I needed to do massive insertion of financial data and ended up writing a request / reply interface. Think QNetworkRequest / Reply and then a dispatcher to handle the scheduling of jobs.

From: Interest <interest-bounces+andrew=dkai.dk at qt-project.org> on behalf of Konstantin Shegunov <kshegunov at gmail.com>
Date: Friday, October 12, 2018 at 8:53 AM
To: Interests Qt <Interest at qt-project.org>
Subject: [Interest] SQL databases and threading

Is there any way to tell (besides looking at the sources) if a given SQL plugin, or single methods of it, is reentrant/thread safe? The docs are rather evasive on the issue ...
What would be allowed to do if I want to thread the SQL queries? Can I serialize the exec/prepare and then pull the resultset in another thread?
Ideally I would like to process the results in a thread if possible, even if I have to serialize the exec.

Currently I'm working with the PQSQL driver, but general answers are acceptable as well.

Thanks in advance.
Kind regards.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20181012/e84b08ec/attachment.html>

More information about the Interest mailing list