[SailfishDevel] Deploy QSQLite database
Lukas Vogel
lukedirtwalkerdev at gmail.com
Tue Jun 17 21:42:27 UTC 2014
Hi there,
I try to create an app in which I want to have an existing database bind in
the binary.
My approach was the following:
in pro file:
QT += sql
database.files = stations.db
database.path = /home/nemo/.local/share/harbour-qtimetable/harbour-qtimetable
INSTALLS += database
To open the database:
db = QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName(DB_NAME);
db.setUserName(USER_NAME);
db.setPassword(PASSWORD);
db.setConnectOptions("QSQLITE_OPEN_READONLY=1");
if(db.open()) {...}
for DB_NAME I use
QStandardPaths::writableLocation(QStandardPaths::DataLocation) with
stations.db appended.
However when I deploy this will fail as the path on emulator has
home/deploy/installroot/ prefix, and when deploying on device there is
/opt/sdk/..
prefix.
This makes testing quite annoying, is there a genuine way to get the
database to open both in the emulator and the device?
Side question is there a "standard path::datalocation" variable for
the .pro file?
Thanks for any help,
Lukas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.sailfishos.org/pipermail/devel/attachments/20140617/94400ed6/attachment.html>
More information about the Devel
mailing list