Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved How to use SQLite in Qt WebAssembly

    Qt for WebAssembly
    3
    3
    708
    Loading More Posts
    • 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.
    • K
      Kallappa last edited by

      Hi,

      I have Qt WASM Setup on Ubuntu-18.04 (Evaluation version - Prebuilt binaries version Qt5.14.0)

      and now the i am trying to use Qt Applications with Sqlite, So in many websites i got only answer is QSQlite is not soupporting Qt WASM.
      and i have tried to build with qmake as follows but no use at all.

      (navigate to Qt installation folder or sql driver plugin source code and compile using qmake)

      cd /home/kmb/Qt/5.14.0/Src/qtbase/src/plugins/sqldrivers
      
      source /home/kmb/Qtwasm/emsdk/emsdk_env.sh
      /home/kmb/Qt/5.14.0/wasm_32/bin/qmake ..
      

      then i got error as
      Project ERROR: Could not find feature sql-psql

      then from Qt Document i found
      https://doc.qt.io/qt-5/sql-driver.html#how-to-build-the-qpsql-plugin-on-unix-and-macos

      ~/Qt/5.14.0/wasm_32/bin/qmake .. -- PSQL_INCDIR=/usr/include/pgsql
      

      then i got error as
      Project ERROR: You cannot configure sqldrivers separately within a top-level build.

      i am searching for the build steps and the Sqlite plugin source code but still i didn't get succed with it. Please suggest me what i am doing wrong aand if any procedure to achieve this.

      Thanks in advance

      JonB 1 Reply Last reply Reply Quote 0
      • JonB
        JonB @Kallappa last edited by JonB

        @Kallappa
        My very lmited understanding is that you are not supposed to/it is not easy to use SQLite with WASM. WASM does not have access to the local file system, there are mentions of ways to "sync" WASM's storage area with the permanent local file system.

        There is one bug report raised discussing this at https://bugreports.qt.io/browse/QTBUG-70443. I don't know if that is still current. See also https://forum.qt.io/topic/94418/qt-web-assembly-support-for-sqlite-database-only-memory-db, https://wiki.qt.io/Qt_for_WebAssembly#Known_issues_and_platform_notes, and https://stackoverflow.com/questions/62114820/how-to-use-sqlite-in-qt-webassembly asked/answered just a couple of months ago.

        @lorn-potter is the guy to answer this definitively, if he sees this.

        S 1 Reply Last reply Reply Quote 0
        • S
          sharath @JonB last edited by

          @JonB I know Qtsql module not supported in Wasm. i believe wasm supports virtual file system and tried QFile read and write operation. why Qt still not support for SQL? even i need Sqlite should work on wasm.
          @lorn-potter can you please answer for this?

          thanks,

          1 Reply Last reply Reply Quote 0
          • First post
            Last post