Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. how to execute sqlite command line with QtSql module database connection?
Forum Update on Tuesday, May 27th 2025

how to execute sqlite command line with QtSql module database connection?

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 340 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.
  • U Offline
    U Offline
    user4592357
    wrote on 8 Jun 2021, 11:59 last edited by
    #1

    i need to create a new sqlite database. with sqlite command line tool, i'd use the following command to do so:

    > sqlite3 file.db "VACUUM;"
    

    how can i do the same with QtSql module?

    1 Reply Last reply
    0
    • C Offline
      C Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 8 Jun 2021, 12:08 last edited by
      #2

      Simply open a QSqlDatabase with QSQLITE and specify your desired file name.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      1
      • U Offline
        U Offline
        user4592357
        wrote on 8 Jun 2021, 12:12 last edited by
        #3

        okay, and do you know if there is a way to specify the schema file from which to create the db?

        1 Reply Last reply
        0
        • C Offline
          C Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on 8 Jun 2021, 12:15 last edited by
          #4

          I don't know what a schema file is and how it looks like but I know this is not supported out-of-the box

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          1 Reply Last reply
          1

          2/4

          8 Jun 2021, 12:08

          • Login

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