Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
4.6.2
-
Linux Kubuntu 10.04 64 bits
-
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.