Good day! How to organize a class that interacts with a database, which must read several interconnected tables (forming one object with data) from a MySQL database and display the corresponding tables with the possibility of editing.

My assumptions - you need to use MVC where the above class will be a model.

What containers are used to store in-memory tables from the database. Which are the most efficient, and what is the model used for working with the database in Qt. Explain to the novice how the application should interact with the database, with large amounts of data, this requires reading / writing and much more. And if someone wants to help (who knows enough qt) with writing an application, you can discuss it by mail.

Closed due to the fact that the issue is too common for the participants user194374, aleksandr barakin , user207618, Streletz , Bald Aug 15 '16 at 3:58 .

Please correct the question so that it describes the specific problem with sufficient detail to determine the appropriate answer. Do not ask a few questions at once. See “How to ask a good question?” For clarification. If the question can be reformulated according to the rules set out in the certificate , edit it .

    1 answer 1

    Qt has special libraries that allow you to execute SQL queries using ODBC drivers, and the results of the query are stored in a special object. You can, of course, parse tables into your own objects, but is it advisable?

    This article describes the basics of working with SQL in Qt.

    • But only in this example there is one table, and I have several tables connected with each other. - Pollet
    • Use queries for related tables in the same way as regular queries - Shadasviar
    • Can you give me an example? Just not at all clear. - Pollet
    • For example SELECT table1.field1, table2.field2 FROM table1 JOIN table2 ON table1.fieldx = table2.fieldy - Shadasviar
    • For each table, your QSqlTableModel? - Pollet