July 2, 2011

soroush soroush
Ant Farmer
818 posts

[SOLVED] Database warning

 

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:

  1. QSqlDatabasePrivate::removeDatabase: connection 'qt_sql_default_connection' is still in use, all queries will cease to work.

5 replies

July 2, 2011

Andre Andre
Robot Herder
6394 posts

That means that there is still a QQuery object around that references the database.

July 2, 2011

soroush soroush
Ant Farmer
818 posts

So, what should I do? Delete all queries before exit?

July 2, 2011

Andre Andre
Robot Herder
6394 posts

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.

July 2, 2011

Eddy Eddy
Area 51 Engineer
1609 posts

Depends… Sometimes a delete of your database pointer is enough.

We can only guess without code….

A profiler like valgrind could help you.

 Signature 

Moderator
Qt Certified Specialist
Nokia Qt Ambassador

July 2, 2011

soroush soroush
Ant Farmer
818 posts

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 :-)

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 ;-)

 
  ‹‹ Where can i find translators for my application?      How to properly store objects into a list ››

You must log in to post a reply. Not a member yet? Register here!