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

QSqlQuery is supposed to be move-only, however we copy it in our code

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Done
    • Affects Version/s: 6.2.4, 6.3.1, 6.4.0 Beta2
    • Fix Version/s: 6.5.0 FF
    • Component/s: SQL Support
    • Labels:
      None

      Description

      Since Qt 6.2 QSqlQuery's copy-constructor and copy-assignment operator are deprecated.

      The rational behind that is that QSqlQuery should be a move-only type.

      However, we still use the deprecated methods in our APIs.

      Specifically:

      • QSqlTableModel::setQuery() takes query by constant reference.
      • QSqlQueryModel::query() returns a copy of the query.

      The first call should be deprecated in favor of a method that takes an rvalue ref, like it is done for QSqlQueryModel::setQuery().

      The second case is more problematic. Probably the best case would be to return a pointer to the current query? With this approach the user will be able to access all the public methods of QSqlQuery. This will, however, require to provide a different name for the pointer getter, or to add an explicit parameter (because function overloads can't differ only by return type).

        Attachments

          Issue Links

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

            Activity

              People

              Assignee:
              ivan.solovev Ivan Solovev
              Reporter:
              ivan.solovev Ivan Solovev
              PM Owner:
              Vladimir Minenko Vladimir Minenko
              RnD Owner:
              Alex Blasche Alex Blasche
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: