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

QSqlTableModel::setData() needs to compare isNull() when comparing old and new QVariant value

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.0.2
    • 5.0.0, 5.0.1
    • SQL Support
    • None
    • Windows 7 x64
    • 33c212b7d25726b78c4bf630548a76feaab872f0

    Description

      Consider the table below:

      CREATE TABLE IF NOT EXISTS collection (
        id INTEGER PRIMARY KEY AUTOINCREMENT,
        parent_id INTEGER,
        order_num INTEGER NOT NULL
      )
      

      When I insert QSqlRecord built with values fetched from QTextEdit's, i.e. pair of strings (parent_id, order_num), I end up with the following results:

      • ("", "0") — QSqlError(-1, "No Fields to update", "")
      • ("", "1") — No error. Row is actually inserted
      • ("0", "0") — QSqlError(-1, "No Fields to update", "")
      • ("1", "0") — QSqlError(19, "Unable to fetch row", "collection.order_num may not be NULL")

      See attachment test2.zip for the minimal demo.

      Attachments

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

        Activity

          People

            mabrand Mark Brand
            dvolosnykh Dmitry Volosnykh
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes