Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Searching without consideratin register in SQLite



  • Hi!
    I use SQLite in my project.
    On russian language is filled the dadaBase.
    When i use filter, searching with consideratin register.

    QSqlTableModel->setFilter("Languages LIKE ('Russian% ')");
    

    How searching without consideratin register in SQLite?
    May be this code can help:

    select 'А' as u, 'а' as l union select 'Б' as u, 'б' as l union select 'В' as u, 'в' as l union select 'Г' as u, 'г' as l union select 'Д' as u, 'д' as l union select 'Е' as u, 'е' as l union select 'Ё' as u, 'ё' as l union select 'Ж' as u, 'ж' as l union select 'З' as u, 'з' as l union select 'И' as u, 'и' as l union select 'Й' as u, 'й' as l union select 'К' as u, 'к' as l union select 'Л' as u, 'л' as l union select 'М' as u, 'м' as l union select 'Н' as u, 'н' as l union select 'О' as u, 'о' as l union select 'П' as u, 'п' as l union select 'Р' as u, 'р' as l union select 'С' as u, 'с' as l union select 'Т' as u, 'т' as l union select 'У' as u, 'у' as l union select 'Ф' as u, 'ф' as l union select 'Х' as u, 'х' as l union select 'Ц' as u, 'ц' as l union select 'Ч' as u, 'ч' as l union select 'Ш' as u, 'ш' as l union select 'Щ' as u, 'щ' as l union select 'Ь' as u, 'ь' as l union select 'Ы' as u, 'ы' as l union select 'Ъ' as u, 'ъ' as l union select 'Э' as u, 'э' as l union select 'Ю' as u, 'ю' as l union select 'Я' as u, 'я' as l
    

  • Lifetime Qt Champion

    @Mikeeeeee said in Searching without consideratin register in SQLite:

    When i use filter, searching with consideratin register

    Can you explain what you mean?



  • If i do:

    TableModel->setFilter("City LIKE '%Москва%' ");
    

    I get the result "Москва"

    If i do:

    TableModel->setFilter("City LIKE '%моСквА%' ");
    

    I do not get the result


  • Lifetime Qt Champion

    @Mikeeeeee Your question isn't related to Qt.
    If you search for "sql case insensitive" in Google you will find how you can do case insensitive string comparisons in SQL:
    https://alvinalexander.com/sql/sql-select-case-insensitive-query-queries-upper-lower


Log in to reply