QSqlTableModel::insertRecord(): clean up after failed setRecord()
Change-Id: Ic9f314144bd3ccf4b59b9cb3f0d79f8d6f97a824 Reviewed-by: Yunqiao Yin <charles.yin@nokia.com>
This commit is contained in:
parent
9c99f23ffb
commit
68cee5258b
2
dist/changes-5.0.0
vendored
2
dist/changes-5.0.0
vendored
@ -355,6 +355,8 @@ ignore the rest of the range.
|
||||
is consistent with the meaning of the flag.
|
||||
-Require all fields to map correctly. Previously fields that didn't
|
||||
map were simply ignored.
|
||||
-For OnManualSubmit, insertRecord() no longer leaves behind an empty
|
||||
row if setRecord() fails.
|
||||
|
||||
****************************************************************************
|
||||
* Database Drivers *
|
||||
|
@ -1079,8 +1079,11 @@ bool QSqlTableModel::insertRecord(int row, const QSqlRecord &record)
|
||||
row = rowCount();
|
||||
if (!insertRow(row, QModelIndex()))
|
||||
return false;
|
||||
if (!setRecord(row, record))
|
||||
if (!setRecord(row, record)) {
|
||||
if (d->strategy == OnManualSubmit)
|
||||
revertRow(row);
|
||||
return false;
|
||||
}
|
||||
if (d->strategy == OnFieldChange || d->strategy == OnRowChange)
|
||||
return submit();
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user