[SailfishDevel] Deploy QSQLite database

Michael Neufing m.neufing at yahoo.de
Wed Jun 18 07:42:19 UTC 2014


Hi,

my app needs an SQLITE db, also. I deploy it into /usr/share/harbour-{APPNAME}/data.
You could then use it either from this location, or copy it into the home dir on the first run.

As the db seems to be readonly, I think you don't need to copy it into the home dir.
 
Mit freundlichen Grüßen, 

Michael Neufing 



Saija Saarenpää <setelani at live.com> schrieb am 8:41 Mittwoch, 18.Juni 2014:
 


Hi,

What comes to having datalocation path variable in the .pro file:
I was having similar thoughts when I wanted to install something in the writable storage location, but I was corrected. Nothing should be installed in the home directory with the application, but under application directory /usr/share/harbour-yourappname/. There can be also subdirs under that location. Then, at runtime, you can create the writable storage location if it does not exist, and copy or create stuff there. Preferably the app would not pre-install any data, but everything would be downloaded / created runtime. That would be the ideal though, not always applicable.

- Saija
@setelani
matrixx #sailfishOS

Lähetetty iPadista

"Andrey Kozhevnikov" <coderusinbox at gmail.com> kirjoitti 18.6.2014 kello 8.50:


you should build and deploy as RPM package ;)


18.06.2014 03:42, Lukas Vogel пишет:

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
>
>
>_______________________________________________ SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscribe at lists.sailfishos.org

_______________________________________________
>SailfishOS.org Devel mailing list
>To unsubscribe, please send a mail to devel-unsubscribe at lists.sailfishos.org

_______________________________________________
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscribe at lists.sailfishos.org

_______________________________________________
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscribe at lists.sailfishos.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.sailfishos.org/pipermail/devel/attachments/20140618/6ca6f358/attachment-0001.html>


More information about the Devel mailing list