QSqlquery exec and prepare sometimes stuck
-
Hello everyone.
I'm facing the following problem:
I have addDatabase in the constructor of my class. I run with qtconcurrent a function that opens the database. The database object is in a variable that called db. When i call another function that executes a query in the db the code stuck. I found that the problem is with exec or with the prepare. This is not happens all the time. Sometimes after a few calls of the same function the code stuck.
Any suggestions? -
@NickV said in QSqlquery exec and prepare sometimes stuck:
I run with qtconcurrent a function that opens the database.
How and why?
-
The code of establishing connection is:
QFuture<void> future = QtConcurrent::run(this, &DatabaseManager::establish_connection);I'm using qtconcurrent because the connection stuck my interface untill database open and this is not very good for my application.