I would like to know the best way to query for a string "contains" another 
string in a case-insensitive manner, and let JOOQ automatically take care 
of all escape characters.

JOOQ 3.6 contains predicates for "likeIgnoreCase" and "contains", but not 
"containsIgnoreCase".

http://www.jooq.org/doc/3.6/manual/sql-building/conditional-expressions/like-predicate/

I can think of at least two logical ways to do this:

1. BOOK.TITLE.lower().contains(myString.toLowerCase());
2. BOOK.TITLE.lower().contains(DSL.lower(myString));

I would suspect that solution number 2 is best because the case conversion 
for both strings is being done in the SQL code.  In solution 1, the case 
conversion for one string is in SQL and the other is in Java, and it is 
possible that the two use different Locales.

I'm pretty sure that this third possibility would be wrong, because 
myString might contain "%":
3. BOOK.TITLE.likeIgnoreCase("%" + myString + "%");

Any advice?

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to