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. Help needed using changeVersion
Forum Updated to NodeBB v4.3 + New Features

Help needed using changeVersion

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 1 Posters 928 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.
  • H Offline
    H Offline
    hoelzro
    wrote on last edited by
    #1

    Hi all,

    I'm working on adding new features to a Qt app I wrote (https://github.com/hoelzro/harbour-sudoku), and one of the features requires a schema change. I wrote a helper routine to detect a storage version mismatch and call changeVersion if needed, but Qt gives me some less-than-helpful output:

    https://gist.github.com/hoelzro/9021552

    Here's the helper routine I wrote:

    https://github.com/hoelzro/harbour-sudoku/blob/db-upgrade/qml/pages/SudokuBoard.qml#L126

    I tried this with a standalone example using qmlscene and was able to duplicate the behavior. Here's the QML file I wrote:

    https://gist.github.com/hoelzro/9021573

    After looking at the code for the local storage module, it seems that the database connection is cached by QSqlDatabase, but then the routine exits in failure before setting the database name. So when there's a version mismatch, it becomes impossible (I think) to open a connection to that database.

    Am I using the changeVersion API completely wrong, or is this a bug? If the latter, what sort of workaround could I use?

    Thanks,
    Rob

    1 Reply Last reply
    0
    • H Offline
      H Offline
      hoelzro
      wrote on last edited by
      #2

      So I figured out a solution to my problem. Unfortunately, it relies on undocumented behavior in the LocalStorage module, but it gets the job done. If you specify an empty string for the version, no version check is done; the database is simply opened.

      1 Reply Last reply
      0

      • Login

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