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.