QSqlTableModel::submitAll(): avoid resubmiting successful changes
authorMark Brand <mabrand@mabrand.nl>
Fri, 10 Feb 2012 02:08:36 +0000 (03:08 +0100)
committerQt by Nokia <qt-info@nokia.com>
Wed, 15 Feb 2012 01:36:33 +0000 (02:36 +0100)
commit7bced2878047840bb9bca58289fa1aa4119f034a
treea256d52c405ce1abd7f77748dc33cf9d867d0834
parent434c46e8dc838cec0d2a2193701c52cc78ba0862
QSqlTableModel::submitAll(): avoid resubmiting successful changes

Consider what happens the 1st change succeeds and the 2nd fails. No
select will be done. When submitAll() is called again, the 1st will
still seem to be pending. It will fail or have unexpected effects if
the primary values were changed.

The solution is to avoid resubmitting successful changes. We leave
them in the cache so they stay visible. Submitted changes cannot
be reverted of course.

Change-Id: Ibf400555effa1c3801d02f8713b4b69856ede23a
Reviewed-by: Yunqiao Yin <charles.yin@nokia.com>
src/sql/models/qsqltablemodel.cpp
src/sql/models/qsqltablemodel_p.h