<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><span>Source code:</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;"><span style=" color:#000080;">Q_DECL_EXPORT</span><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">int</span><span style=" color:#c0c0c0;"> </span><span style=" color:#000000;">main</span><span style=" color:#000000;">(</span><span style=" color:#808000;">int</span><span style=" color:#c0c0c0;"> </span><span style=" color:#000000;">argc</span><span style=" color:#000000;">,</span><span style="
color:#c0c0c0;"> </span><span style=" color:#808000;">char</span><span style=" color:#c0c0c0;"> </span><span style=" color:#000000;">*</span><span style=" color:#000000;">argv</span><span style=" color:#000000;">[]) {</span>
</span></div><pre style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span class="tab"> </span>...<br></pre><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span style=" color:#800080;"><span class="tab"> </span>FileHandler</span><span style=" color:#c0c0c0;"> </span><span style=" color:#000000;">*</span><span style=" color:#000000;">fileHandler</span><span style=" color:#c0c0c0;"> </span><span style=" color:#000000;">=</span><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">new</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">FileHandler</span><span style=" color:#000000;">();</span>
</div><pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#000000;"> view</span><span style=" color:#000000;">-></span><span style=" color:#000000;">rootContext</span><span style=" color:#000000;">()-></span><span style=" color:#000000;">setContextProperty</span><span style=" color:#000000;">(</span><span style=" color:#008000;">"fileHandler"</span><span style=" color:#000000;">,</span><span style=" color:#c0c0c0;"> </span><span style=" color:#000000;">fileHandler</span><span style=" color:#000000;">);</span></pre>
<pre style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> ...<br></pre><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;">}<br><span></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br><span style=" color:#800080;">FileHandler</span><span style=" color:#000000;">::</span><span style=" color:#000000;">FileHandler</span><span style=" color:#000000;">(</span><span style=" color:#800080;">QObject</span><span style=" color:#c0c0c0;"> </span><span style=" color:#000000;">*</span><span style=" color:#000000;">parent</span><span style=" color:#000000;">)</span><span style=" color:#c0c0c0;"> </span><span style=" color:#000000;">:</span><span style="
color:#c0c0c0;"><span style="font-family: monospace;"> </span></span><span style=" color:#800080;">QObject</span><span style=" color:#000000;">(</span><span style=" color:#000000;">parent</span><span style=" color:#000000;">)</span><span style=" color:#000000;"> {</span></div><div style="color: rgb(192, 192, 192); font-size: 16px; font-family: monospace; background-color: transparent; font-style: normal;"><span style="color: rgb(0, 0, 0);"><span style="font-family: times new roman,new york,times,serif;"> ...</span></span><br></div><pre style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> // /usr/share/Stockona/<br> </span><span style=" color:#800080;"> QString</span><span style=" color:#c0c0c0;"> </span><span style=" color:#000000;">dbPath</span><span style=" color:#c0c0c0;"> </span><span style="
color:#000000;">=</span><span style=" color:#c0c0c0;"> </span><span style=" color:#000000;"></span><span style=" color:#800080;">QString</span><span style=" color:#000000;">(</span><span style=" color:#000080;">DEPLOYMENT_PATH</span><span style=" color:#000000;">);</span><span style=" color:#000000;"></span>
<span style=" color:#c0c0c0;"> </span><span style=" color:#000000;">dbPath</span><span style=" color:#000000;">.</span><span style=" color:#000000;">append</span><span style=" color:#000000;">(</span><span style=" color:#008000;">".stockona_db"</span><span style=" color:#000000;">);</span>
<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">qDebug</span><span style=" color:#000000;">()</span><span style=" color:#c0c0c0;"> </span><span style=" color:#000000;"><<</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"DB</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">path="</span><span style=" color:#c0c0c0;"> </span><span style=" color:#000000;"><<</span><span style=" color:#c0c0c0;"> </span><span style=" color:#000000;">dbPath</span><span style=" color:#000000;">;</span>
<span style=" color:#c0c0c0;"><br></span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QSqlDatabase</span><span style=" color:#c0c0c0;"> </span><span style=" color:#000000;">db</span><span style=" color:#c0c0c0;"> </span><span style=" color:#000000;">=</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QSqlDatabase</span><span style=" color:#000000;">::</span><span style=" color:#000000;">addDatabase</span><span style=" color:#000000;">(</span><span style=" color:#008000;">"QSQLITE"</span><span style=" color:#000000;">);</span>
<span style=" color:#c0c0c0;"> </span><span style=" color:#000000;">db</span><span style=" color:#000000;">.</span><span style=" color:#000000;">setDatabaseName</span><span style=" color:#000000;">(</span><span style=" color:#000000;">dbPath</span><span style=" color:#000000;">);<span class="tab"><br><span class="tab"><span class="tab"> </span></span>// Cannot open database when deployed as rpm</span><br></span><span class="tab"> </span><span style=" color:#c0c0c0;"></span><span style=" color:#808000;">bool</span><span style=" color:#c0c0c0;"> </span><span style=" color:#000000;">ok</span><span style=" color:#c0c0c0;"> </span><span style=" color:#000000;">=</span><span style=" color:#c0c0c0;"> </span><span style=" color:#000000;">db</span><span style=" color:#000000;">.</span><span style=" color:#000000;">open</span><span style=" color:#000000;">();</span><br> ...<br>} <br></pre><div><br></div> <div
style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div dir="ltr"> <hr size="1"> <font size="2" face="Arial"> <b><span style="font-weight:bold;">From:</span></b> Andrey Kozhevnikov <coderusinbox@gmail.com><br> <b><span style="font-weight: bold;">To:</span></b> devel@lists.sailfishos.org <br> <b><span style="font-weight: bold;">Sent:</span></b> Monday, November 11, 2013 11:32 PM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [SailfishDevel] QSqlDatabase cannot create db file when deployed as rpm package<br> </font> </div> <div class="y_msg_container"><br><div id="yiv4915412466"><div>
My project working with QSQLITE local database, and everything good
:)<br clear="none">
<br clear="none">
Share your code and we can found issues.<br clear="none">
<br clear="none">
<div class="yiv4915412466yqt9414099898" id="yiv4915412466yqt61773"><div class="yiv4915412466moz-cite-prefix">On 12.11.2013 02:35, Stockona wrote:<br clear="none">
</div>
<blockquote type="cite">
<div style="color:#000;background-color:#fff;font-family:times new roman, new york, times, serif;font-size:12pt;">When I
switched to "Deploy by copying binary", the database is created
and connected correctly.
<div>Changing the deployment to rpm package the same code just
failed with database error message "out of memory Error
opening database."</div>
<div><br clear="none">
</div>
<div style="color:rgb(0, 0, 0);font-size:16px;font-family:times new roman, new york, times, serif;background-color:transparent;font-style:normal;">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?</div>
<div style="color:rgb(0, 0, 0);font-size:16px;font-family:times new roman, new york, times, serif;background-color:transparent;font-style:normal;">Thanks in advance!<br clear="none">
</div>
<div style="color:rgb(0, 0, 0);font-size:16px;font-family:times new roman, new york, times, serif;background-color:transparent;font-style:normal;"><br clear="none">
</div>
</div>
<br clear="none">
<fieldset class="yiv4915412466mimeAttachmentHeader"></fieldset>
<br clear="none">
<pre>_______________________________________________
SailfishOS.org Devel mailing list</pre>
</blockquote></div>
<br clear="none">
</div></div><br><div class="yqt9414099898" id="yqt85380">_______________________________________________<br clear="none">SailfishOS.org Devel mailing list</div><br><br></div> </div> </div> </div></body></html>