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

QSqlRelationalTableModel doesn't correctly work with relation in other database schema

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 4.6.1
    • 4.6.0
    • SQL Support
    • 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])));

      Attachments

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

        Activity

          People

            andysh Andy Shaw
            cdsmika Tseluyko Dmitriy
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes