Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-16007

QSqlTableModel::removeRows() fails to remove rows with NULL values.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 4.7.4
    • 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)

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            mgoddard Michael Goddard (closed Nokia identity) (Inactive)
            sortasean Sean Jeffries
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes