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. Creating Database tables by using QT code.
Qt 6.11 is out! See what's new in the release blog

Creating Database tables by using QT code.

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 2.6k 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.
  • M Offline
    M Offline
    MyQT
    wrote on last edited by
    #1

    I want to create blank database tables(@ 30 tables) and schema from code in QT.
    So that my application will use it later. I am using SQL lite database.
    has anybody done this? Please let me know the idea about this?

    Thanks in advance.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      Sure. Just use the right SQL to create the tables. It is just like executing queries.

      Qt does not have have a high-level API to do this. You'll have to code it yourself using SQL statements, and those will be database dependent. I have written some extended drivers in the past that could do this database independently, but I guess that is not your issue here.

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Adding to what Andre said, the Sql module examples show the basics of what you want to do, that might be a good starting point for inspiration.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #4

          For the SQL part, I guess the "relevant part of the SQLite docs":http://www.sqlite.org/lang_createtable.html would come in handy...

          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