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

aliases with dots are not correctly taken into account by QSqlQuery

    XMLWordPrintable

Details

    • 18be0749eb58316036d6eaff9dc5fecc1379f31a

    Description

      It seems that QSqlQuery ignores the left part of a dotted column alias defined with "AS" 
      in a "SELECT" statement.
      See the attached CPP file.
      The problem is that below, we have -1 as a result for:

      query.record().indexOf( "person.firstname" )

      (we have defined a query with "AS 'person.firstname'" as alias for the 
      "firstname" column of "person" table)

      This means that the column name "person.firstname" is not found by 
      .indexOf().

      .indexOf() gives the correct result by writing:
      .indexOf( "firstname" )

      This means that the left part of the dotted alias is ignored. But there may be several aliases in the query with the same right part, so it is a problem.

      Note that if "person.firstname" is changed in "person_firstname" in both the 
      SELECT statement and in .indexOf(), we obtain 0 which is the correct result.

      Attachments

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

        Activity

          People

            markan Marko Kangas
            metasequoia Julien SCORDIA
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes