Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Problem with filter on a QSqlRelationalTableModel when non latin characters

Problem with filter on a QSqlRelationalTableModel when non latin characters

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 3 Posters 586 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Panoss
    wrote on last edited by
    #1

    I apply a filter on a QSqlRelationalTableModel:

    filter =  "(articles.name LIKE '%" + searchText +  "%')";
    model->setFilter(filter);
    

    If search text is latin characters, the search result is fine.
    But when I enter greek characters the search result is not correct.
    How can I fix this?
    Something like utf8 for the QSqlRelationalTableModel filter?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Which backend are you using ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • P Offline
        P Offline
        Panoss
        wrote on last edited by Panoss
        #3

        Hi @SGaist. What do you mean by 'backend'?

        Qt Creator 6.0.2
        SQLite
        I have no idea if I covered you! :)

        1 Reply Last reply
        0
        • P Offline
          P Offline
          Panoss
          wrote on last edited by Panoss
          #4

          The problem when I enter non latin characters has something to do with upper and lower case (with non latin characters): when I enter text with different case than what is in the db, I get nothing. If I enter the text with the same case as in the db, the result is correct.
          With latin no problem.

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            That's by design in SQLite, nothing related to Qt.

            This article goes in depth about that situation.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            2
            • P Offline
              P Offline
              Panoss
              wrote on last edited by Panoss
              #6

              I will create another field in this table where I will store the same data as the ones in the field 'name', but in lower case. So I 'll do my searches on this new field!
              I think it's the easiest way.

              jsulmJ 1 Reply Last reply
              0
              • P Panoss

                I will create another field in this table where I will store the same data as the ones in the field 'name', but in lower case. So I 'll do my searches on this new field!
                I think it's the easiest way.

                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @Panoss said in Problem with filter on a QSqlRelationalTableModel when non latin characters:

                I think it's the easiest way

                Adding "COLLATE NOCASE IN" to your select query is easier...

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                P 1 Reply Last reply
                1
                • jsulmJ jsulm

                  @Panoss said in Problem with filter on a QSqlRelationalTableModel when non latin characters:

                  I think it's the easiest way

                  Adding "COLLATE NOCASE IN" to your select query is easier...

                  P Offline
                  P Offline
                  Panoss
                  wrote on last edited by Panoss
                  #8

                  @jsulm said in Problem with filter on a QSqlRelationalTableModel when non latin characters:

                  @Panoss said in Problem with filter on a QSqlRelationalTableModel when non latin characters:

                  I think it's the easiest way

                  Adding "COLLATE NOCASE IN" to your select query is easier...

                  The "COLLATE NOCASE IN" is giving me an error:
                  'Execution finished with errors.
                  Result: near "ΙΝ": syntax error'

                  So there is no "COLLATE NOCASE IN", only "COLLATE NOCASE".
                  Which works correctly only for latin characters.

                  1 Reply Last reply
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved