[Qt-interest] running QSqlQuery's in a worker thread?

Kaleb Pederson kaleb.pederson at gmail.com
Fri Jun 5 21:29:14 CEST 2009


On Fri, Jun 5, 2009 at 12:19 PM, Scott Aron
Bloom<Scott.Bloom at sabgroup.com> wrote:
> So here is my problem, Im working on an app, where an individual sql query
> can take up to 10 seconds (sometimes longer if the system is really getting
> hammered)..
>
> The problem is, the system is an inventory search system, so its “very” open
> in the types of searches that can be done.   Sometimes, a search cant take
> 2-3 minutes.
>
> The problem of course, is that the GUI freezes while the SQL query is being
> executed.
>
> What I was thinking was something like this, and I wanted to know if anyone
> has a better solution..

I've done something similar.

I changed my status bar to indicate that a query was in progress and
then disabled all further queries while that was running.  It allowed
the users to navigate and do (certain) other things while waiting for
the query, but didn't block the Gui and allowed them to cancel the
operation.

I'm sure there are other possibilities as well.

--Kaleb




More information about the Qt-interest-old mailing list