Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
4.6.0
-
None
Description
The problem in QTBUG-5373 is not resolved in qt4.6.0.
The class still creates wrong sql string like:
SELECT docob.task."id", docob.task."name", docob.task."is_main_object", docob.task."filter", docob.task."is_readonly", relTblAl_5.name AS docob.task_name_3, docob.task."icon_name", relTblAl_7.name AS docob.application_name_2, docob.task."is_editable", docob.task."num", docob.task."title" FROM docob.task, docob.task relTblAl_5, docob.application relTblAl_7 WHERE (docob.task."id_task" = relTblAl_5.id AND docob.task."id_application" = relTblAl_7.id)
As you see namespace docob.task_name_3 is not allowed.
To solve this problem just qoute mark is needed like this: relTblAl_5.name AS "docob.task_name_3"
To implement this you need to add qoute mark to the function QString QSqlRelationalTableModel::selectStatement() const like this:
fList.append(QString::fromLatin1(" AS \"%1_%2_%3\"").arg(relTableName).arg(displayColumn).arg(fieldNames.value(fieldList[i])));
instead of
fList.append(QString::fromLatin1(" AS %1_%2_%3").arg(relTableName).arg(displayColumn).arg(fieldNames.value(fieldList[i])));