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".
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?