Details
-
Bug
-
Resolution: Done
-
P2: Important
-
4.6.3
-
None
-
This bug was observed using Qt4.6.3 on windows 7 64bit.
-
346af37b7bc8d97ae4cc24b0a1cfe9cf4802057b
Description
QSqlTableModel::removeRows() cannot delete rows with NULL values. removeRows() returns true, but a subsequent call to QSqlTableModel::submitAll() to complete the transaction returns false. This is due a bug in QSqlTableModel::deleteRowFromTable(int row) where the "whereValues" are being passed to QSqlTableModelPrivate::exec(stmt, prepStatement, rec, whereValues) as the rec values. The last line of deleteRowFromTable() reads:
return d->exec(stmt, prepStatement, whereValues);
but should read:
return d->exec(stmt, prepStatement, QSqlRecord(), whereValues);
This code change fixes the problem. The bug is demonstrated in the bug below. (Thanks to the author of QTBUG-14916, I borrowed some of his source for this bug demo)