Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to store a array with QML in database



  • 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



  • 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.


Log in to reply