<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    you should build and deploy as RPM package ;)<br>
    <br>
    <div class="moz-cite-prefix">18.06.2014 03:42, Lukas Vogel пишет:<br>
    </div>
    <blockquote
cite="mid:CAJG5b_UPhbbHT5-nFWBVBt_hBQPPdgERd-9U8T+1tH3ULdrrKA@mail.gmail.com"
      type="cite">
      <div dir="ltr">Hi there,
        <div><br>
        </div>
        <div>I try to create an app in which I want to have an existing
          database bind in the binary.</div>
        <div><br>
        </div>
        <div>My approach was the following: </div>
        <div>in pro file:</div>
        <div>
          <font color="#000000">QT</font><span
            style="color:rgb(192,192,192)"> </span>+=<span
            style="color:rgb(192,192,192)"> </span>sql</div>
        <div>
          <pre style="margin-top:0px;margin-bottom:0px">
</pre>
          <pre style="margin-top:0px;margin-bottom:0px"><pre style="margin-top:0px;margin-bottom:0px">database.files<span style="color:rgb(192,192,192)"> </span>=<span style="color:rgb(192,192,192)"> </span>stations.db</pre><pre style="margin-top:0px;margin-bottom:0px">database.path<span style="color:rgb(192,192,192)"> </span>=<span style="color:rgb(192,192,192)"> </span>/home/nemo/.local/share/harbour-qtimetable/harbour-qtimetable</pre>
<pre style="margin-top:0px;margin-bottom:0px">INSTALLS += database</pre><pre style="margin-top:0px;margin-bottom:0px">
</pre><pre style="margin-top:0px;margin-bottom:0px">To open the database:</pre><pre style="margin-top:0px;margin-bottom:0px">db = QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName(DB_NAME);
db.setUserName(USER_NAME);
db.setPassword(PASSWORD);
db.setConnectOptions("QSQLITE_OPEN_READONLY=1");
</pre><pre style="margin-top:0px;margin-bottom:0px">if(db.open()) {...}</pre><pre style="margin-top:0px;margin-bottom:0px">
</pre><pre style="margin-top:0px;margin-bottom:0px">for DB_NAME I use QStandardPaths::writableLocation(QStandardPaths::DataLocation) with stations.db appended. </pre><pre style="margin-top:0px;margin-bottom:0px">
</pre><pre style="margin-top:0px;margin-bottom:0px">However when I deploy this will fail as the path on emulator has</pre>
<pre style="margin-top:0px;margin-bottom:0px">home/deploy/installroot/ prefix, and when deploying on device there is /opt/sdk/..
</pre><pre style="margin-top:0px;margin-bottom:0px">prefix. </pre><pre style="margin-top:0px;margin-bottom:0px">
</pre><pre style="margin-top:0px;margin-bottom:0px">This makes testing quite annoying, is there a genuine way to get the database to open both in the emulator and the device? </pre><pre style="margin-top:0px;margin-bottom:0px">
</pre><pre style="margin-top:0px;margin-bottom:0px">Side question is there a "standard path::datalocation" variable for the .pro file?</pre><pre style="margin-top:0px;margin-bottom:0px">
</pre><pre style="margin-top:0px;margin-bottom:0px">Thanks for any help,</pre><pre style="margin-top:0px;margin-bottom:0px">Lukas</pre></pre>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to <a class="moz-txt-link-abbreviated" href="mailto:devel-unsubscribe@lists.sailfishos.org">devel-unsubscribe@lists.sailfishos.org</a></pre>
    </blockquote>
    <br>
  </body>
</html>