File missing error for: /QtSql/private/qsqlcachedresult_p.h [SOLVED]
-
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.
-
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 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?