Some questions about qml and sqlite javascript parsing



  • Suppose the part of my code for parsing all tables from a database called 'databaseName' is, (in Javascript)
    @
    var rs = tx.executeSql('SELECT * FROM namesTable ORDER BY id ASC');
    @

    And my 'namesTable' would look like this
    @
    id name City Country
    1 "James" NY USA
    2 "Frank" KZ GBA
    3 "Don" KR IN
    @

    1) what would be the value of "rs"? I want to know how that object look like.
    Is it represented in javascript like below ? Or in any other method?
    @
    rs = {{id:"1", name:"James", City:"NY", Country: "USA"},
    {id:"2", name:"Frank", City:"KZ", Country: "GBA"},
    {id:"4", name:"DOn", City:"KR", Country: "IN"}}
    @

    2) Whichever way, What would be the notation to read data from this from a QML file?
    (if i map rerturn "rs" from javascript to an object "obj" in QML, how can i get the individual values?
    eg: obj["1"].name ? )

    3) And how can i put the values of this table in a Listmodel?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.