PDA

View Full Version : Database closing warnings



ComaWhite
9th December 2010, 00:23
I've been trying to write an ORM database for my application. The problem is, the end user has to do:

QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE", "Foo");

then pass it to my class for dealing with all the database stuff, queries, etc.

But when I call close on it, I get "QSqlDatabasePrivate::removeDatabase: connection 'foo' is still in use, all queries will cease to work."

I've tried many ways of doing the closing and I can't get the warnings to disappear.

wysota
9th December 2010, 00:31
Make sure no object referring to the database connection exists when you call removeDatabase(). In particular also the "db" object of yours has to go out of scope before you call removeDatabase().