Inserted Data not getting saved in DB.



  • I'm using a local DB in my project.

    Something like:

    @
    qml
    \app123
    \main.qml
    \OfflineStorage
    \DataBases
    \md5(db123).sqlite
    \md5(db123).ini
    @

    The access is made after setting the offline storage path like:

    @
    #ifdef Q_WS_SIMULATOR
    viewer.engine()->setOfflineStoragePath("qml/OfflineStorage");
    #else
    QString privatePathQt(QApplication::applicationDirPath());
    QString pathOfflineStorage(privatePathQt);
    pathOfflineStorage.append(QDir::separator()).append("qml/OfflineStorage");
    pathOfflineStorage = QDir::toNativeSeparators(pathOfflineStorage);
    viewer.engine()->setOfflineStoragePath(pathOfflineStorage);
    #endif@

    and then in QML:

    @
    var database = openDatabaseSync("db123","1.0","db123",1000000);
    database.transaction(
    function(tx) {
    var rs = tx.executeSql("SELECT * FROM table");
    console.log(rs.rows.length);
    }
    );
    @

    Everything's fine untill here, i get the correct number of regists in that table.
    Then i update it by inserting some more and get the correct updated amount.

    When i restart the app the DB loads with the same number of regists as before(it didn't save the changes i did while in the simulator/device)


Log in to reply
 

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