Android的SQLite的LIKE转义通配符 [英] Android SQLite LIKE escape wildcard
本文介绍了Android的SQLite的LIKE转义通配符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Android 4.1的Jellybean是有可能逃脱LIKE通配符,而且还有类似使用索引?
On Android Jellybean 4.1 is it possible to escape a LIKE wildcard character and still have the like use the index?
的使用:的
where field like 'xyz\_abc'
的而不是:的
where field like 'xyz_abc'
是否逃逸通配符在Android上工作?而将它仍然使用索引如果通配符逃脱?
Does escaping wildcards work on Android? And will it still use the index if the wildcard is escaped?
什么我目前做的是:
where field like 'xyz_abc' and lower(field) = lower('xyz_abc')
这是可怕的低效由于通配符。
Which is horribly inefficient due to the wildcard character.
感谢
推荐答案
您需要使用 ESCAPE
子句:
where field like 'xyz\_abc' escape '\'
请参见等,GLOB运营商在 SQLite的文档。
See the section The LIKE and GLOB operators in the SQLite Documentation.
这篇关于Android的SQLite的LIKE转义通配符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文