Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to store a array with QML in database
Qt 6.11 is out! See what's new in the release blog

How to store a array with QML in database

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 2 Posters 2.1k 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.
  • T Offline
    T Offline
    tattoo
    wrote on last edited by
    #1

    Hello All,

    I want to store some informtaion persistently, for that i am using the QML openDataBaseSync method, but i am not getting how i can store list of values associated with a key in my database.

    I can store a single value with key and populate it one my ui, but suppose i have a Food Item as my key like burger and i want to store two values like rating and comments associated with burger how can i do that.

    Any information will be appreciated. :-)

    Thanks

    1 Reply Last reply
    0
    • F Offline
      F Offline
      favoritas37
      wrote on last edited by
      #2

      Just create a new table in the SQL database that will be called Food and will have all the appropriate fields.
      Also create
      @
      'Food(name TEXT, rating TEXT, comment TEXT)'
      @

      Then it is all up to SQL usage to use the SET and UPDATE to retrieve the info that you want.

      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