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. Inserted Data not getting saved in DB.
Forum Updated to NodeBB v4.3 + New Features

Inserted Data not getting saved in DB.

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 1.2k 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.
  • S Offline
    S Offline
    Sypter
    wrote on 15 Jun 2012, 11:29 last edited by
    #1

    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)

    1 Reply Last reply
    0

    1/1

    15 Jun 2012, 11:29

    • Login

    • Login or register to search.
    1 out of 1
    • First post
      1/1
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved