[SailfishDevel] QSqlDatabase cannot create db file when deployed as rpm package

Andrey Kozhevnikov coderusinbox at gmail.com
Tue Nov 12 08:30:21 UTC 2013


ah. you have no write permissions to these folders.
create db in /home/nemo/.local/share/Sockona
or /home/nemo/.config/Stockona

On 12.11.2013 14:25, Stockona wrote:
> I have QT += sql in my pro.
> DB path= "/usr/share/Stockona/.stockona_db"
> By the way, db.lastError().text() and type() gave me:
> "Error: DB failed to open,  "out of memory Error opening database"  
> errorType= 1"
>
> The path I got when deployed as binary was:
> DB path= "/opt/sdk/Stockona/usr/share/Stockona/.stockona_db"
> Database file can be created as expected with this configuration.
>
> Thanks,
> William
>
> ------------------------------------------------------------------------
> *From:* Andrey Kozhevnikov <coderusinbox at gmail.com>
> *To:* devel at lists.sailfishos.org
> *Sent:* Tuesday, November 12, 2013 12:14 AM
> *Subject:* Re: [SailfishDevel] QSqlDatabase cannot create db file when 
> deployed as rpm package
>
> have you added sql to your project CONFIG?
>
> and what is resulting dbPath value?
>
> On 12.11.2013 14:12, 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/
>>       QString  dbPath  =  QString(DEPLOYMENT_PATH);
>>      dbPath.append(".stockona_db");
>>      qDebug()  <<  "DB  path="  <<  dbPath;
>>
>>      QSqlDatabase  db  =  QSqlDatabase::addDatabase("QSQLITE");
>>      db.setDatabaseName(dbPath);
>>      // Cannot open database when deployed as rpm
>>      bool  ok  =  db.open();
>>     ...
>> }
>>
>> ------------------------------------------------------------------------
>> *From:* Andrey Kozhevnikov <coderusinbox at gmail.com> 
>> <mailto:coderusinbox at gmail.com>
>> *To:* devel at lists.sailfishos.org <mailto:devel at 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 all. Is this a permission issue? How do I work around this?
>>> Thanks in advance!
>>>
>>>
>>>
>>> _______________________________________________
>>> SailfishOS.org Devel mailing list
>>
>>
>> _______________________________________________
>> SailfishOS.org Devel mailing list
>>
>>
>>
>>
>> _______________________________________________
>> SailfishOS.org Devel mailing list
>
>
> _______________________________________________
> SailfishOS.org Devel mailing list
>
>
>
>
> _______________________________________________
> SailfishOS.org Devel mailing list

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.sailfishos.org/pipermail/devel/attachments/20131112/5f06d657/attachment.html>


More information about the Devel mailing list