Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Creating Database tables by using QT code.



  • 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.



  • 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.


  • Lifetime Qt Champion

    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.



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


Log in to reply