I execute query wich take about 5-6min. When I do this my application is freeze. Is there any chance to avoid this?
I use firebird embeded database so I cant execut query in other thread.
sory for my poor english.
I execute query wich take about 5-6min. When I do this my application is freeze. Is there any chance to avoid this?
I use firebird embeded database so I cant execut query in other thread.
sory for my poor english.
Yes, why not?
Because execute your request in another thread is your only chance.
You execute your request from the qt main loop (HMI thread) so your HMI is frozen until the request isn't finished.
With a little bit of chance, and if you can do that, you can call QCoreApplication:rocessEvents() (static method)
each time you can while you're executing your long treatment so the main loop will (try) to execute HMI request waiting for execution.
Your HMI will execute some events (refresh some values for example) but your HMI will still look as frozen...
Good luck
I cant use another thread because when I execute query I have open some sql table and cant close it. I use embeded firebird so I cant manage another connection to databse for second thread.
Also I cant use rocessEvents() because I execute one statement (not in loop) and firebird engin do all work.
If you do all queries in a separate thread, you don't have to worry about leaving an open table in the main thread.
so is it safe to do queries in separate thread with connection from main thread?
I know I cant use one connection object for two queries running in the same time from two different threads.
Should I create and open connection (con1) in thread which I use to execut queries?
If I do that is it safe to use this connection(con1) to open and view sql table in main thread?
so it is impossible to have open sql table in main thread and execute queries in other thread when I have one connection object. I cant close my table so I cant execute query in other thread(cant create another connection).
Is Firebird really limited to a single connection or am I missing something here? That doesn't seem to be the case from a quick glance at the docs.
5 or 6 minutes to execute a single query on an embedded database seems a bit excessive. Is it trawling through billions of records or doing some convoluted outer-joining monstrosity? Can you do anything to speed this up? Indexes, temporary intermediate tables, split the work into stages etc.
Bookmarks