Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. File missing error for: /QtSql/private/qsqlcachedresult_p.h [SOLVED]
Forum Update on Monday, May 27th 2025

File missing error for: /QtSql/private/qsqlcachedresult_p.h [SOLVED]

Scheduled Pinned Locked Moved Qt Creator and other tools
7 Posts 3 Posters 6.4k 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.
  • M Offline
    M Offline
    mogles
    wrote on last edited by
    #1

    I am using Qt Creator 2.1.0 on Linux Mint

    I have been researching how to connect to a SQLite database and in the process I added an include for <QtSql/qsql_sqlite.h>. I am now getting the file missing error. The QTSql folder doesn't have a sub-folder named private.
    X
    Also, in the past I have always used a connection string like:
    "Data Source=/Home/Mark/Databases/MotorData.sqlite;Version=3;New=False;Compress=True;"
    I'm having difficulty time finding a similar reference in the Qt documentation. Doesn't the SQLite wrapper need the above info?

    Your help is most appreciated.

    1 Reply Last reply
    0
    • L Offline
      L Offline
      lgeyer
      wrote on last edited by
      #2

      To use a SQLite database:

      • add the sql module to your .pro file (QT += sql).
      • include <QtSql/QSqlDatabase>
      • use QSqlDatabase::addDatabase("QSQLITE") to get a database object
      • set the SQLite filename using setDatabaseName()

      Just see the various "examples":http://qt.gitorious.org/qt/qt/blobs/4.7/examples/sql/connection.h.

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

        In your applications, do not rely on private headers. They may or may not be available, and they may change or be removed at any time, at any release.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mogles
          wrote on last edited by
          #4

          [quote author="Lukas Geyer" date="1321339075"]To use a SQLite database:

          • add the sql module to your .pro file (QT += sql).
          • include <QtSql/QSqlDatabase>
          • use QSqlDatabase::addDatabase("QSQLITE") to get a database object
          • set the SQLite filename using setDatabaseName()

          Just see the various "examples":http://qt.gitorious.org/qt/qt/blobs/4.7/examples/sql/connection.h.[/quote]

          Most of what you suggested I already had in place. The thing I find that seems significant is there is no example for connecting to an existing database. Connecting to an in memory database following the example provides a connection as expected. However, I am trying to connect to an existing database. Most all posts show using a windows path. So how is setDatabaseName used when you have an existing database?

          1 Reply Last reply
          0
          • L Offline
            L Offline
            lgeyer
            wrote on last edited by
            #5

            Just point to your existing database file.
            @
            database.setDatabaseName("c:/path/to/database.file");
            @

            1 Reply Last reply
            0
            • M Offline
              M Offline
              mogles
              wrote on last edited by
              #6

              Thanks for your patience. Life is good again.:)

              1 Reply Last reply
              0
              • L Offline
                L Offline
                lgeyer
                wrote on last edited by
                #7

                You're welcome. Feel free to edit the topic to "[Solved] ..." if it has been solved for you to indicate that it actually is and that there is a solution inside.

                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