[SOLVED] Database warning
-
wrote on 2 Jul 2011, 14:25 last edited by
Hi
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.
@ -
wrote on 2 Jul 2011, 16:44 last edited by
That means that there is still a QQuery object around that references the database.
-
wrote on 2 Jul 2011, 16:49 last edited by
So, what should I do? Delete all queries before exit?
-
wrote on 2 Jul 2011, 18:23 last edited by
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.
-
wrote on 2 Jul 2011, 18:23 last edited by
Depends... Sometimes a delete of your database pointer is enough.
We can only guess without code....
A profiler like valgrind could help you.
-
wrote on 2 Jul 2011, 18:30 last edited by
Thank 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 ;-)
1/6