SQLite accent-insensitive search

爷,独闯天下 提交于 2019-11-26 17:50:14

问题


Is there any way to do an accent-insensitive LIKE query in SQLite? For example, this query:

SELECT * FROM users WHERE name LIKE "Andre%"

would return:

André the Giant
Andre Agassi
etc.

I'm using Qt with QSqlDatabase if it makes any difference.


回答1:


Set up a collation using sqlite3_create_collation and then use it like this:

SELECT * FROM users WHERE name LIKE "Andre%" COLLATE NOACCENTS


来源:https://stackoverflow.com/questions/14009261/sqlite-accent-insensitive-search

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!