Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Deploy Sqlite db file on iOS and Winphone?
QtWS25 Last Chance

Deploy Sqlite db file on iOS and Winphone?

Scheduled Pinned Locked Moved Installation and Deployment
3 Posts 2 Posters 773 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    AlekseyShi
    wrote on last edited by
    #1

    Code below it works on Android, but how to do same on iOS and Winphone?

    QFile dfile("assets:/db/database-last.db3");
    if (dfile.exists())
    {
        dfile.copy("./database-last.db3");
        QFile::setPermissions("./database-last.db3",QFile::WriteOwner |     QFile::ReadOwner);
     }
    

    ...

    QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
    db.setDatabaseName("./database-last.db3");
    db.open();
    

    ...

    in .pro file

    deployment.files += database-last.db3
    deployment.path = /assets/db
    INSTALLS += deployment
    
    jsulmJ 1 Reply Last reply
    0
    • A AlekseyShi

      Code below it works on Android, but how to do same on iOS and Winphone?

      QFile dfile("assets:/db/database-last.db3");
      if (dfile.exists())
      {
          dfile.copy("./database-last.db3");
          QFile::setPermissions("./database-last.db3",QFile::WriteOwner |     QFile::ReadOwner);
       }
      

      ...

      QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
      db.setDatabaseName("./database-last.db3");
      db.open();
      

      ...

      in .pro file

      deployment.files += database-last.db3
      deployment.path = /assets/db
      INSTALLS += deployment
      
      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @AlekseyShi Here you try to write in current directory:

      dfile.copy("./database-last.db3");
      

      This not going to work then that directory isn't writeable by your application (and the installation directory of an mobile app isn't writable!).
      You should use one of the standard directories from http://doc.qt.io/qt-5/qstandardpaths.html (QStandardPaths::AppDataLocation)

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • A Offline
        A Offline
        AlekseyShi
        wrote on last edited by AlekseyShi
        #3

        It works on Android by set permissions. My question is for iOS and Winphone concerning to pack dbfile into *.dmg.
        *But I'll try your advice too. :)

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved