Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Like case sensitive in room persistence library

How to apply case sensitive with LIKE query when use room persistence library android??

using below query

@Query("SELECT * FROM category WHERE category_name LIKE '%' || :categoryName|| '%'")
List<Category> getAllCategory(@Nullable String categoryName);

Use PRAGMA case_sensitive_like = on not working

like image 820
Lokesh Avatar asked Nov 15 '25 18:11

Lokesh


1 Answers

By Help of pskink found answer:

Use GLOB instead of LIKE, Successful Query as below

@Query("SELECT * FROM category WHERE category_name GLOB '*' || :categoryName|| '*'")
List<Category> getAllCategory(@Nullable String categoryName);
like image 159
Lokesh Avatar answered Nov 18 '25 09:11

Lokesh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!