optionally retrieve unescaped pattern where available#1372
optionally retrieve unescaped pattern where available#1372njr-11 wants to merge 2 commits intojakartaee:mainfrom
Conversation
|
I am not sure that every database allows patterns with no escape character. @beikov do you recall? |
This isn't necessarily a problem here because we are keeping the |
|
Some databases have a default escape character (usually The SQL spec says that the like predicate by default should not have an escape character, but you seem to prefer defaulting to What I don't quite understand is why the |
|
My comment was about knowing if the escape is present or not, in the JPA Criteria (which we also use in Micronaut for internal query construction) there are those variations: So I would prefer to invoke specific method based on the information if the escape char is defined on not. Right know I will have to always trigger the one with the escape. |
There are many ways to construct a
For the subset of usage where a
It was my intention that what I already added under this PR would give you that ability. You first ask for the |
|
It's fine to leave it like it is or do the renaming as you suggest. I just thought it might be better to avoid computing something that isn't always necessary. |
In #1365 (comment) @dstepanov requested the ability to use unescaped patterns for
LikeandNotLikeconstraints. It does make sense this could be an optimization, although I can also see a good case for how we currently have it, where queries allowing for an escape character can be computed in advance and will work regardless. This PR explores what a compromise might look like that offers the Jakarta Data provider to request either way. It adds a.unescapedPattern()method toLikeandNotLikethat returns a pattern without any escape character if such a pattern is available. If unavailable, then the Jakarta Data provider needs to fall back to using the existing methods for a pattern with an escape character. Alternatively, the Jakarta Data provider could choose to use the existing methods regardless, which will always work.