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.
|
is consistent with the meaning of the flag.
|
||||||
-Require all fields to map correctly. Previously fields that didn't
|
-Require all fields to map correctly. Previously fields that didn't
|
||||||
map were simply ignored.
|
map were simply ignored.
|
||||||
|
-For OnManualSubmit, insertRecord() no longer leaves behind an empty
|
||||||
|
row if setRecord() fails.
|
||||||
|
|
||||||
****************************************************************************
|
****************************************************************************
|
||||||
* Database Drivers *
|
* Database Drivers *
|
||||||
|
@ -1079,8 +1079,11 @@ bool QSqlTableModel::insertRecord(int row, const QSqlRecord &record)
|
|||||||
row = rowCount();
|
row = rowCount();
|
||||||
if (!insertRow(row, QModelIndex()))
|
if (!insertRow(row, QModelIndex()))
|
||||||
return false;
|
return false;
|
||||||
if (!setRecord(row, record))
|
if (!setRecord(row, record)) {
|
||||||
|
if (d->strategy == OnManualSubmit)
|
||||||
|
revertRow(row);
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
if (d->strategy == OnFieldChange || d->strategy == OnRowChange)
|
if (d->strategy == OnFieldChange || d->strategy == OnRowChange)
|
||||||
return submit();
|
return submit();
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user