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. Install sqlite database file together with Application
Forum Updated to NodeBB v4.3 + New Features

Install sqlite database file together with Application

Scheduled Pinned Locked Moved Installation and Deployment
4 Posts 2 Posters 1.0k Views 1 Watching
  • 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.
  • B Offline
    B Offline
    b3tchi
    wrote on last edited by
    #1

    Hi,

    I have SQLite Database file "MyDb.db" in my project folder I would like to deploy this file together with application
    to the build folder. My question is what is right approach to do that and its same for Mobile targets and Desktop targets.

    Thank you, for any help

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Does this database contain any data ? If not, then you can avoid include it and generate it from your application otherwise you can embed it with qrc and on the first application run (or if the database is missing) copy it to an appropriate folder using QStandardPaths to retrieve the right folder for that.

      Hope it helps

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • B Offline
        B Offline
        b3tchi
        wrote on last edited by
        #3

        SGaist thanks for reply. Sqlite will be contain data, I was also thinking about embedding with qrc but I'm not sure if this ideal solution on mobile devices if the database will be big and then I will be almost doubling size of application.

        Let's put the question different way.
        I'm working on something as Dictionary app where I need to be able to modify data of the Dictionary. I'm wondering what will be the ideal design for that. I would like to avoid making read-write copy of read-only file on mobile targets.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Be it mobile or desktop, if you want to modify your database you'll need a read-write file. Either a copy of an initial database or a constructed one. There's also the possibility of using something like a web service to contain the database but it has other implications

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          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