Closed jexp closed 7 months ago
- Less Than Equal, Greater Than Equal (missing in jooq @lukaseder)
See QOM.Le
, QOM.Ge
- TRUE / FALSE (are they in SQL @lukaseder?)
Yes, there are org.jooq.True
, org.jooq.False
, and org.jooq.Null
. They should probably be reflected in the QOM
API for better discoverablity: https://github.com/jOOQ/jOOQ/issues/14537
Regarding these:
- Regular expressions https://neo4j.com/docs/cypher-manual/current/clauses/where/#query-where-regex
- String predicates STARTS WITH, ENDS WITH, CONTAINS -> LIKE ?
My suggestion here is:
QOM.StartsWith
, etc. which are mere jOOQ convenience. They can't be parsed, currently, as there is not SQL equivalentLike
can be pattern matched as follows:
org.jooq.Param
), then process that Param
in the translatorx%
: STARTS WITH
%x
: ENDS WITH
%x%
: CONTAINS
%
or _
then apply below regex ruleLIKE
into a regex: <lhs> ~= replace(replace(quoteForRegex(<rhs>), '%', '.*'), '_', '.')
, optionally handling the LIKE .. ESCAPE
clausefor LIKE: might even make sense to do the replace in cypher, so that non-literal values (parameters) or expressions are also handled correctly.
the only tricky bit is escaping for regexp, perhaps something like:
reduce(s=str, rep IN [['?','\?'], ...['_','.'],['%','.*']] | s = replace(s, rep[0],rep[1])
or alternatively spell it out with a replace cascade
might even make sense to do the replace in cypher, so that non-literal values (parameters) or expressions are also handled correctly.
That's what I meant by "Otherwise turn LIKE
into a regex: <lhs> ~=
"
Ah you didn't mean replacing the string in the transpiler but in the generated statement. Yep, sgtm.
Well, if there's a constant (org.jooq.Param
), then that can be processed in the translator. Otherwise, it simply cannot.
I've added support for BETWEEN SYMMETRIC
too. Dogfooding has shown that the QOM
API needed a significant refactoring: https://github.com/jOOQ/jOOQ/issues/14546, so I've moved the tag
Kamino closed and cloned this issue to neo4j/neo4j-jdbc
Conditional Operators / Predicates
https://neo4j.com/docs/cypher-manual/current/clauses/where/#boolean-operations
Predicate functions https://neo4j.com/docs/cypher-manual/current/functions/predicate/