QSqlTableModel and Data Repopulation



  • I have posted this on "stackoverflow":http://stackoverflow.com/questions/19651373/qsqltablemodel-and-data-repopulation but I figured it would be good to discuss it here as well.

    Basically I am worried about the behaviour of the QSqlTableModel's edit strategies that repopulate the model upon successful update of the database. If the table is very large then such transaction seems extremely costly especially considering only single field could be updated in the actual database...

    It might not be such a big deal for single model but since I intend to have a lot of them running simultaneously in the server up serving clients and updating data for them it might be an issue. One option would definitely be to use manual submitting however I would like to use the SQL auto-increment index as well and that is only given to a record on update.

    I would appreciate any suggestions and thoughts on this problem. Thanks!


    As an idea to solve this I could sub-class QSqlQueryModel, maintain the index myself and implement empty custom "refresh()" method that would not actually update the model from the database after submitting the data. Since in my case I am accessing the model programatically and there will be no changes to the database other than via the custom QSqlQueryModel there should not be a need to repopulate the data. But maybe I am only not seeing the problems with this...


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.