Qt World Summit: Submit your Presentation

[SOLVED]How to access sqlite rowid

  • Hi,
    I have a LocalStorage with a table created with tx.executeSql('CREATE TABLE IF NOT EXISTS Cards(one TEXT, two TEXT)');
    Now I'm trying to update the model with:

    var rs = tx.executeSql('SELECT * FROM Cards');
    for(var i = 0; i < rs.rows.length; i++) {
    var item = rs.rows.item(i);
    console.debug("update", item.rowid);
    model.append({"rowid":item.rowid, "one": item.one, "two": item.two});

    But I'm just getting the output qml: update undefined
    Does someone know how to access the implicit sqlite rowid?
    Thanks in advance.

  • @belab
    Found it:var rs = tx.executeSql('SELECT rowid, * FROM Cards');

Log in to reply