Results 1 to 2 of 2

Thread: Database closing warnings

  1. #1
    Join Date
    Mar 2008
    Location
    Houston, Texas, USA
    Posts
    277
    Thanks
    9
    Thanked 17 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Maemo/MeeGo

    Default Database closing warnings

    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.
    Qt-4.7.3 | Gentoo ~amd64 | KDE-4.7
    Aki IRC Client for KDE4 | Qt Documentation

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Database closing warnings

    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().
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. The following user says thank you to wysota for this useful post:

    ComaWhite (9th December 2010)

Similar Threads

  1. Deprecated warnings still appear
    By Caius Aérobus in forum Qt Programming
    Replies: 0
    Last Post: 29th March 2010, 08:25
  2. Where are my compiler warnings?
    By drhex in forum General Programming
    Replies: 5
    Last Post: 18th February 2009, 21:28
  3. Crosscompiling warnings
    By SteM in forum Installation and Deployment
    Replies: 1
    Last Post: 2nd August 2007, 20:26
  4. Makefile warnings
    By Doug Broadwell in forum Qt Programming
    Replies: 2
    Last Post: 15th May 2007, 19:42
  5. Qt 4.1.1 linker warnings
    By Matt Smith in forum Installation and Deployment
    Replies: 0
    Last Post: 26th February 2006, 22:14

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.