Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for WebAssembly
  4. How to use SQLite in Qt WebAssembly
QtWS25 Last Chance

How to use SQLite in Qt WebAssembly

Scheduled Pinned Locked Moved Unsolved Qt for WebAssembly
3 Posts 3 Posters 1.2k Views
  • 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 Offline
    K Offline
    Kallappa
    wrote on last edited by
    #1

    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

    JonBJ 1 Reply Last reply
    0
    • K Kallappa

      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

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @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
      0
      • JonBJ 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 Offline
        S Offline
        sharath
        wrote on last edited by
        #3

        @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
        0

        • Login

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