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

Caching QSqlQueries



  • In order to allow caching the changes in QSqlRelationalTableModel i changed it's EditStrategy to OnManualSubmit, but at the same time I am using QSqlQueries to update values of records or to copy the records.

    I was trying to work 100% on the models by getting the records (I can paste the exact code, but here it is for the brevity):

    QSqlRecord record_basis = table_model->database().record(table_name);
    record.setValue(...);
    ...
    table_model->insertRecord(record );
    

    but it failed with the QSqlRelationalTableModel, was workingo only fine with QSqlTableModel so I switched to work with table queries.

    Is there any neat way of caching QSqlQueries and executing them on submit? I guess no, because QSqlQueries work directly on the table, not on the model. Should I just create queue and call them one buy one before submit?


Log in to reply