QSqlDatabase and upgrade to Qt5.12
Alain38 0 last edited by
I have an application that uses a QSqlDatabase. This application has been developed with Qt5.9. Now, I have to upgrade it to work with Qt5.12. But I have a problem with a class (singleton) using a QSqlDatabase. This class manages an SQLite base (stored in memory). This base is filled, and accessed by processes that consume a lot of resources. So, each of these processes is executed using QtConcurrent. With Qt5.9 everything worked well. Unfortunately with Qt5.12 nothing works. Because the database must be now in the same thread that the process using it. But:
The database is created when the singleton is create. Thus, it is created on the main thread,
Usually (even if some exceptions exist), the database is accessed by a process that is in a specific thread (undetermined as it is defined by QtConcurrent)
So, how can I solve this problem, without having to do a whole rewriting of all parts of the application using the database?
Thanks in advance for your help.
JonB last edited by
Unfortunately with Qt5.12 nothing works. Because the database must be now in the same thread that the process using it.
I'm surprised it used to work at all. So far as I understood, it was always the case that database access had to be in same thread as where database created.