[SOLVED] Database warning
I write a small database project for my homework (Database Design). Everything is good, else than a warning: when exiting program always this warning is shown in terminal:
QSqlDatabasePrivate::removeDatabase: connection 'qt_sql_default_connection' is still in use, all queries will cease to work.
That means that there is still a QQuery object around that references the database.
So, what should I do? Delete all queries before exit?
That would depend on how you designed your application. If you have your QQuery objects on the stack, make sure they run out of scope before your database does. If you have them on the heap, you can delete them before your database is destroyed. An even simpler approach would be to simply ignore the warning. It won't hurt you.
Depends... Sometimes a delete of your database pointer is enough.
We can only guess without code....
A profiler like valgrind could help you.
I ran out of scope of methods that was at least one query used in them and also deleted pointers to queries. now there is no warning :-)
bq. An even simpler approach would be to simply ignore the warning. It won’t hurt you.
I know, this is a homework => should look clear ;-)