Exactly, unless you develop a "system service", you definitely want to store
the db under user's home directory. See QStandardPaths[1] and Google
for "XDG" if you need more info.
Martin
[1] http://qt-project.org/doc/qt-5.0/qtcore/qstandardpaths.html
On Tuesday, November 12, 2013 08:48:11 AM Jonni Rainisto wrote:
> User processes only have write permissions to /home/nemo
>
> So usually your application should use something like
>
> /home/nemo/.local/share/applicationame/database.db
> or
> /home/nemo/.config/applicationame/database.db
>
> re, Jonni
>
> ________________________________
> From: devel-boun...@lists.sailfishos.org
> [devel-boun...@lists.sailfishos.org] on behalf of Martin Kampas
> [martin.kam...@ubedi.net] Sent: Tuesday, November 12, 2013 10:25
AM
> To: Sailfish OS Developers
> Subject: Re: [SailfishDevel] QSqlDatabase cannot create db file when
> deployed as rpm package
>
>
> Hi
>
>
>
> My guess is missing write permissions under /usr/share. Are you sure
with
> the location you chose? I would expect it somewhere under /var instead.
> Google for Filesystem Hierarchy Standard if you are not sure about this.
>
>
>
> Martin
>
> On Tuesday, November 12, 2013 12:12:53 AM Stockona wrote:
> > Source code:
> >
> >
> >
> > Q_DECL_EXPORTintmain(intargc,char*argv[]) {
> >
> > ...
> >
> > FileHandler*fileHandler=newFileHandler();
> >
> > view->rootContext()->setContextProperty("fileHandler",fileHandler);
> >
> > ...
> >
> >
> >
> > }
> >
> >
> >
> >
> >
> > FileHandler::FileHandler(QObject*parent):QObject(parent){
> >
> > ...
> >
> > // /usr/share/Stockona/
> >
> > QStringdbPath=QString(DEPLOYMENT_PATH);
dbPath.append(".stockona_db");
> >
> > qDebug()<<"DBpath="<<dbPath;
> >
> > QSqlDatabasedb=QSqlDatabase::addDatabase("QSQLITE");
> >
> > db.setDatabaseName(dbPath); // Cannot open database when
deployed as rpm
> >
> > boolok=db.open();
> >
> > ...
> >
> > }
> >
> >
> >
> >
> >
> >
> >
> > ________________________________
> >
> > From: Andrey Kozhevnikov <coderusin...@gmail.com>
> >
> > To: devel@lists.sailfishos.org
> >
> > Sent: Monday, November 11, 2013 11:32 PM
> >
> > Subject: Re: [SailfishDevel] QSqlDatabase cannot create db file when
> >
> > deployed as rpm package
> >
> >
> >
> >
> >
> >
> >
> > My project working with QSQLITE local database, and everything good
:)
> >
> >
> >
> > Share your code and we can found issues.
> >
> >
> >
> >
> >
> > On 12.11.2013 02:35, Stockona wrote:
> >
> >
> >
> > When I switched to "Deploy by copying binary", the database is
created and
> >
> > connected correctly.
> >
> > >Changing the deployment to rpm package the same code just failed
with
> > >
> > >database error message "out of memory Error opening database."
> > >
> > >
> > >
> > >
> > >
> > >I checked in Emulator terminal and the database file was not
created at
> > >
_______________________________________________
SailfishOS.org Devel mailing list