Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] Database warning

[SOLVED] Database warning

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 3.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    soroush
    wrote on last edited by
    #1

    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.
    @

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      • S Offline
        S Offline
        soroush
        wrote on last edited by
        #3

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

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0
          • EddyE Offline
            EddyE Offline
            Eddy
            wrote on last edited by
            #5

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

            We can only guess without code....

            A profiler like valgrind could help you.

            Qt Certified Specialist
            www.edalsolutions.be

            1 Reply Last reply
            0
            • S Offline
              S Offline
              soroush
              wrote on last edited by
              #6

              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 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved