From 7ada988d9e0cb20161d3a4cd8b7516d63fbd2e1c Mon Sep 17 00:00:00 2001 From: Lukas Eder Date: Fri, 12 Nov 2021 16:48:27 +0100 Subject: [PATCH] [jOOQ/jOOQ#982] Add support for GIS extensions - Added support for ST_Intersects and ST_Intersection - Added support for ST_Overlaps and ST_Touches - Added support for ST_Union --- jOOQ/src/main/java/org/jooq/impl/DSL.java | 301 ++++++++ jOOQ/src/main/java/org/jooq/impl/Names.java | 6 + .../main/java/org/jooq/impl/ParserImpl.java | 651 ++++++++++-------- jOOQ/src/main/java/org/jooq/impl/QOM.java | 76 ++ .../java/org/jooq/impl/StIntersection.java | 191 +++++ .../main/java/org/jooq/impl/StIntersects.java | 187 +++++ .../main/java/org/jooq/impl/StIsClosed.java | 169 +++++ .../main/java/org/jooq/impl/StOverlaps.java | 187 +++++ .../main/java/org/jooq/impl/StTouches.java | 187 +++++ jOOQ/src/main/java/org/jooq/impl/StUnion.java | 198 ++++++ 10 files changed, 1879 insertions(+), 274 deletions(-) create mode 100644 jOOQ/src/main/java/org/jooq/impl/StIntersection.java create mode 100644 jOOQ/src/main/java/org/jooq/impl/StIntersects.java create mode 100644 jOOQ/src/main/java/org/jooq/impl/StIsClosed.java create mode 100644 jOOQ/src/main/java/org/jooq/impl/StOverlaps.java create mode 100644 jOOQ/src/main/java/org/jooq/impl/StTouches.java create mode 100644 jOOQ/src/main/java/org/jooq/impl/StUnion.java diff --git a/jOOQ/src/main/java/org/jooq/impl/DSL.java b/jOOQ/src/main/java/org/jooq/impl/DSL.java index 7f21346187..299cc48b2b 100644 --- a/jOOQ/src/main/java/org/jooq/impl/DSL.java +++ b/jOOQ/src/main/java/org/jooq/impl/DSL.java @@ -20840,6 +20840,307 @@ public class DSL { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jOOQ/src/main/java/org/jooq/impl/Names.java b/jOOQ/src/main/java/org/jooq/impl/Names.java index e7b9e9b407..ed435a0bc8 100644 --- a/jOOQ/src/main/java/org/jooq/impl/Names.java +++ b/jOOQ/src/main/java/org/jooq/impl/Names.java @@ -431,10 +431,16 @@ final class Names { static final Name N_ST_CONTAINS = unquotedName("st_contains"); static final Name N_ST_ENDPOINT = unquotedName("st_endpoint"); static final Name N_ST_GEOMFROMTEXT = unquotedName("st_geomfromtext"); + static final Name N_ST_INTERSECTION = unquotedName("st_intersection"); + static final Name N_ST_INTERSECTS = unquotedName("st_intersects"); + static final Name N_ST_IS_CLOSED = unquotedName("st_is_closed"); static final Name N_ST_LENGTH = unquotedName("st_length"); static final Name N_ST_NUMPOINTS = unquotedName("st_numpoints"); + static final Name N_ST_OVERLAPS = unquotedName("st_overlaps"); static final Name N_ST_POINTN = unquotedName("st_pointn"); static final Name N_ST_STARTPOINT = unquotedName("st_startpoint"); + static final Name N_ST_TOUCHES = unquotedName("st_touches"); + static final Name N_ST_UNION = unquotedName("st_union"); static final Name N_ST_WITHIN = unquotedName("st_within"); static final Name N_ST_X = unquotedName("st_x"); static final Name N_ST_Y = unquotedName("st_y"); diff --git a/jOOQ/src/main/java/org/jooq/impl/ParserImpl.java b/jOOQ/src/main/java/org/jooq/impl/ParserImpl.java index 38fc71b8f0..772aebe960 100644 --- a/jOOQ/src/main/java/org/jooq/impl/ParserImpl.java +++ b/jOOQ/src/main/java/org/jooq/impl/ParserImpl.java @@ -312,6 +312,12 @@ import static org.jooq.impl.DSL.square; // ... // ... // ... +// ... +// ... +// ... +// ... +// ... +// ... import static org.jooq.impl.DSL.stddevPop; import static org.jooq.impl.DSL.stddevSamp; import static org.jooq.impl.DSL.sum; @@ -6142,19 +6148,360 @@ final class DefaultParseContext extends AbstractScope implements ParseContext { } private final QueryPart parsePredicate() { + Condition condition; - if (parseKeywordIf("EXISTS")) - return exists(parseParenthesised(c -> parseWithOrSelect())); - else if (parseKeywordIf("REGEXP_LIKE")) - return parseFunctionArgs2(Field::likeRegex); - else if (parseKeywordIf("UNIQUE")) - return unique(parseParenthesised(c -> parseWithOrSelect())); - else if (parseKeywordIf("JSON_EXISTS")) { + + switch (characterUpper()) { + case 'D': + + + + + + + break; + + case 'E': + if (parseKeywordIf("EXISTS")) + return exists(parseParenthesised(c -> parseWithOrSelect())); + + break; + + case 'I': + + + + + + + break; + + case 'J': + if ((condition = parsePredicateJSONExistsIf()) != null) + return condition; + + break; + + case 'R': + if (parseKeywordIf("REGEXP_LIKE")) + return parseFunctionArgs2(Field::likeRegex); + + break; + + case 'S': + if (parseFunctionNameIf("ST_CONTAINS") && requireProEdition()) { + + + + } + else if (parseFunctionNameIf("ST_INTERSECTS") && requireProEdition()) { + + + + } + else if (parseFunctionNameIf("ST_ISCLOSED") && requireProEdition()) { + + + + } + else if (parseFunctionNameIf("ST_OVERLAPS") && requireProEdition()) { + + + + } + else if (parseFunctionNameIf("ST_TOUCHES") && requireProEdition()) { + + + + } + else if (parseFunctionNameIf("ST_WITHIN") && requireProEdition()) { + + + + } + + break; + + case 'U': + if (parseKeywordIf("UNIQUE")) + return unique(parseParenthesised(c -> parseWithOrSelect())); + + + + + + + + break; + + case 'X': + if ((condition = parsePredicateXMLExistsIf()) != null) + return condition; + + break; + } + + FieldOrRow left; + Comparator comp; + TSQLOuterJoinComparator outer; + boolean not; + boolean notOp = false; + + left = parseConcat(); + not = parseKeywordIf("NOT"); + + + if (!not && ((outer = parseTSQLOuterJoinComparatorIf()) != null) && requireProEdition()) { + Condition result = null; + + + + + + + + + + + + + return result; + } + else if (!not && (comp = parseComparatorIf()) != null) { + boolean all = parseKeywordIf("ALL"); + boolean any = !all && (parseKeywordIf("ANY") || parseKeywordIf("SOME")); + if (all || any) + parse('('); + + // TODO equal degrees + Condition result = + all + ? left instanceof Field + ? peekSelectOrWith(true) + ? ((Field) left).compare(comp, DSL.all(parseWithOrSelect(1))) + : ((Field) left).compare(comp, DSL.all(parseList(',', c -> c.parseField()).toArray(EMPTY_FIELD))) + + // TODO: Support quantifiers also for rows + : new RowSubqueryCondition((Row) left, DSL.all(parseWithOrSelect(((Row) left).size())), comp) + + : any + ? left instanceof Field + ? peekSelectOrWith(true) + ? ((Field) left).compare(comp, DSL.any(parseWithOrSelect(1))) + : ((Field) left).compare(comp, DSL.any(parseList(',', c -> c.parseField()).toArray(EMPTY_FIELD))) + + // TODO: Support quantifiers also for rows + : new RowSubqueryCondition((Row) left, DSL.any(parseWithOrSelect(((Row) left).size())), comp) + + : left instanceof Field + ? ((Field) left).compare(comp, toField(parseConcat())) + : new RowCondition((Row) left, parseRow(((Row) left).size(), true), comp); + + if (all || any) + parse(')'); + + return result; + } + else if (!not && parseKeywordIf("IS")) { + not = parseKeywordIf("NOT"); + + if (parseKeywordIf("NULL")) + return not + ? left instanceof Field + ? ((Field) left).isNotNull() + : ((Row) left).isNotNull() + : left instanceof Field + ? ((Field) left).isNull() + : ((Row) left).isNull(); + else if (left instanceof Field && parseKeywordIf("JSON")) + return not + ? ((Field) left).isNotJson() + : ((Field) left).isJson(); + else if (left instanceof Field && parseKeywordIf("DOCUMENT")) + return not + ? ((Field) left).isNotDocument() + : ((Field) left).isDocument(); + + not = parseKeywordIf("DISTINCT FROM") == not; + if (left instanceof Field) { Field f = (Field) left; + Field right = toField(parseConcat()); + return not ? f.isNotDistinctFrom(right) : f.isDistinctFrom(right); + } + else { + Row right = parseRow(((Row) left).size(), true); + return new RowIsDistinctFrom((Row) left, right, not); + } + } + else if (!not && parseIf("@>")) { + return toField(left).contains((Field) toField(parseConcat())); + } + else if (!forbidden.contains(FK_IN) && parseKeywordIf("IN")) { + Condition result; + parse('('); + if (peek(')')) + result = not + ? left instanceof Field + ? ((Field) left).notIn(EMPTY_FIELD) + : new RowInCondition((Row) left, new QueryPartList<>(), true) + : left instanceof Field + ? ((Field) left).in(EMPTY_FIELD) + : new RowInCondition((Row) left, new QueryPartList<>(), false); + else if (peekSelectOrWith(true)) + result = not + ? left instanceof Field + ? ((Field) left).notIn(parseWithOrSelect(1)) + : new RowSubqueryCondition((Row) left, parseWithOrSelect(((Row) left).size()), NOT_IN) + : left instanceof Field + ? ((Field) left).in(parseWithOrSelect(1)) + : new RowSubqueryCondition((Row) left, parseWithOrSelect(((Row) left).size()), IN); + else + result = not + ? left instanceof Field + ? ((Field) left).notIn(parseList(',', c -> c.parseField())) + : new RowInCondition((Row) left, new QueryPartList<>(parseList(',', c -> parseRow(((Row) left).size()))), true) + : left instanceof Field + ? ((Field) left).in(parseList(',', c -> c.parseField())) + : new RowInCondition((Row) left, new QueryPartList<>(parseList(',', c -> parseRow(((Row) left).size()))), false); + + parse(')'); + return result; + } + else if (parseKeywordIf("BETWEEN")) { + boolean symmetric = !parseKeywordIf("ASYMMETRIC") && parseKeywordIf("SYMMETRIC"); + FieldOrRow r1 = left instanceof Field + ? parseConcat() + : parseRow(((Row) left).size()); + parseKeyword("AND"); + FieldOrRow r2 = left instanceof Field + ? parseConcat() + : parseRow(((Row) left).size()); + + return symmetric + ? not + ? left instanceof Field + ? ((Field) left).notBetweenSymmetric((Field) r1, (Field) r2) + : new RowBetweenCondition((Row) left, (Row) r1, not, symmetric, (Row) r2) + : left instanceof Field + ? ((Field) left).betweenSymmetric((Field) r1, (Field) r2) + : new RowBetweenCondition((Row) left, (Row) r1, not, symmetric, (Row) r2) + : not + ? left instanceof Field + ? ((Field) left).notBetween((Field) r1, (Field) r2) + : new RowBetweenCondition((Row) left, (Row) r1, not, symmetric, (Row) r2) + : left instanceof Field + ? ((Field) left).between((Field) r1, (Field) r2) + : new RowBetweenCondition((Row) left, (Row) r1, not, symmetric, (Row) r2); + } + else if (left instanceof Field && (parseKeywordIf("LIKE") || parseOperatorIf("~~") || (notOp = parseOperatorIf("!~~")))) { + if (parseKeywordIf("ANY")) { + parse('('); + if (peekSelectOrWith(true)) { + Select select = parseWithOrSelect(); + parse(')'); + LikeEscapeStep result = (not ^ notOp) ? ((Field) left).notLike(any(select)) : ((Field) left).like(any(select)); + return parseEscapeClauseIf(result); + } + else { + List> fields; + if (parseIf(')')) { + fields = emptyList(); + } + else { + fields = parseList(',', c -> toField(parseConcat())); + parse(')'); + } + Field[] fieldArray = fields.toArray(new Field[0]); + LikeEscapeStep result = (not ^ notOp) ? ((Field) left).notLike(any(fieldArray)) : ((Field) left).like(any(fieldArray)); + return parseEscapeClauseIf(result); + } + } + else if (parseKeywordIf("ALL")) { + parse('('); + if (peekSelectOrWith(true)) { + Select select = parseWithOrSelect(); + parse(')'); + LikeEscapeStep result = (not ^ notOp) ? ((Field) left).notLike(all(select)) : ((Field) left).like(all(select)); + return parseEscapeClauseIf(result); + } + else { + List> fields; + if (parseIf(')')) { + fields = emptyList(); + } + else { + fields = parseList(',', c -> toField(parseConcat())); + parse(')'); + } + Field[] fieldArray = fields.toArray(new Field[0]); + LikeEscapeStep result = (not ^ notOp) ? ((Field) left).notLike(all(fieldArray)) : ((Field) left).like(all(fieldArray)); + return parseEscapeClauseIf(result); + } + } + else { + Field right = toField(parseConcat()); + LikeEscapeStep like = (not ^ notOp) ? ((Field) left).notLike(right) : ((Field) left).like(right); + return parseEscapeClauseIf(like); + } + } + else if (left instanceof Field && (parseKeywordIf("ILIKE") || parseOperatorIf("~~*") || (notOp = parseOperatorIf("!~~*")))) { + Field right = toField(parseConcat()); + LikeEscapeStep like = (not ^ notOp) ? ((Field) left).notLikeIgnoreCase(right) : ((Field) left).likeIgnoreCase(right); + return parseEscapeClauseIf(like); + } + else if (left instanceof Field && (parseKeywordIf("REGEXP") + || parseKeywordIf("RLIKE") + || parseKeywordIf("LIKE_REGEX") + || parseOperatorIf("~") + || (notOp = parseOperatorIf("!~")))) { + Field right = toField(parseConcat()); + return (not ^ notOp) + ? ((Field) left).notLikeRegex(right) + : ((Field) left).likeRegex(right); + } + else if (left instanceof Field && parseKeywordIf("SIMILAR TO")) { + Field right = toField(parseConcat()); + LikeEscapeStep like = not ? ((Field) left).notSimilarTo(right) : ((Field) left).similarTo(right); + return parseEscapeClauseIf(like); + } + else if (left instanceof Row && ((Row) left).size() == 2 && parseKeywordIf("OVERLAPS")) { + Row leftRow = (Row) left; + Row rightRow = parseRow(2); + + Row2 leftRow2 = row(leftRow.field(0), leftRow.field(1)); + Row2 rightRow2 = row(rightRow.field(0), rightRow.field(1)); + + return leftRow2.overlaps(rightRow2); + } + else + return left; + } + + private final Condition parsePredicateXMLExistsIf() { + if (parseKeywordIf("XMLEXISTS")) { + parse('('); + Field xpath = (Field) parseField(); + XMLPassingMechanism m = parseXMLPassingMechanism(); + Field xml = (Field) parseField(); + parse(')'); + + if (m == BY_REF) + return xmlexists(xpath).passingByRef(xml); + else if (m == BY_VALUE) + return xmlexists(xpath).passingByValue(xml); + else + return xmlexists(xpath).passing(xml); + } + + return null; + } + + private final Condition parsePredicateJSONExistsIf() { + if (parseKeywordIf("JSON_EXISTS")) { parse('('); Field json = parseField(); parse(','); @@ -6175,274 +6522,8 @@ final class DefaultParseContext extends AbstractScope implements ParseContext { return jsonExists(json, path); } - else if (parseKeywordIf("XMLEXISTS")) { - parse('('); - Field xpath = (Field) parseField(); - XMLPassingMechanism m = parseXMLPassingMechanism(); - Field xml = (Field) parseField(); - parse(')'); - if (m == BY_REF) - return xmlexists(xpath).passingByRef(xml); - else if (m == BY_VALUE) - return xmlexists(xpath).passingByValue(xml); - else - return xmlexists(xpath).passing(xml); - } - else if (parseFunctionNameIf("ST_CONTAINS") && requireProEdition()) { - - - - } - else if (parseFunctionNameIf("ST_WITHIN") && requireProEdition()) { - - - - } - - - - - - - - - - else { - FieldOrRow left; - Comparator comp; - TSQLOuterJoinComparator outer; - boolean not; - boolean notOp = false; - - left = parseConcat(); - not = parseKeywordIf("NOT"); - - - if (!not && ((outer = parseTSQLOuterJoinComparatorIf()) != null) && requireProEdition()) { - Condition result = null; - - - - - - - - - - - - - return result; - } - else if (!not && (comp = parseComparatorIf()) != null) { - boolean all = parseKeywordIf("ALL"); - boolean any = !all && (parseKeywordIf("ANY") || parseKeywordIf("SOME")); - if (all || any) - parse('('); - - // TODO equal degrees - Condition result = - all - ? left instanceof Field - ? peekSelectOrWith(true) - ? ((Field) left).compare(comp, DSL.all(parseWithOrSelect(1))) - : ((Field) left).compare(comp, DSL.all(parseList(',', c -> c.parseField()).toArray(EMPTY_FIELD))) - - // TODO: Support quantifiers also for rows - : new RowSubqueryCondition((Row) left, DSL.all(parseWithOrSelect(((Row) left).size())), comp) - - : any - ? left instanceof Field - ? peekSelectOrWith(true) - ? ((Field) left).compare(comp, DSL.any(parseWithOrSelect(1))) - : ((Field) left).compare(comp, DSL.any(parseList(',', c -> c.parseField()).toArray(EMPTY_FIELD))) - - // TODO: Support quantifiers also for rows - : new RowSubqueryCondition((Row) left, DSL.any(parseWithOrSelect(((Row) left).size())), comp) - - : left instanceof Field - ? ((Field) left).compare(comp, toField(parseConcat())) - : new RowCondition((Row) left, parseRow(((Row) left).size(), true), comp); - - if (all || any) - parse(')'); - - return result; - } - else if (!not && parseKeywordIf("IS")) { - not = parseKeywordIf("NOT"); - - if (parseKeywordIf("NULL")) - return not - ? left instanceof Field - ? ((Field) left).isNotNull() - : ((Row) left).isNotNull() - : left instanceof Field - ? ((Field) left).isNull() - : ((Row) left).isNull(); - else if (left instanceof Field && parseKeywordIf("JSON")) - return not - ? ((Field) left).isNotJson() - : ((Field) left).isJson(); - else if (left instanceof Field && parseKeywordIf("DOCUMENT")) - return not - ? ((Field) left).isNotDocument() - : ((Field) left).isDocument(); - - not = parseKeywordIf("DISTINCT FROM") == not; - if (left instanceof Field) { Field f = (Field) left; - Field right = toField(parseConcat()); - return not ? f.isNotDistinctFrom(right) : f.isDistinctFrom(right); - } - else { - Row right = parseRow(((Row) left).size(), true); - return new RowIsDistinctFrom((Row) left, right, not); - } - } - else if (!not && parseIf("@>")) { - return toField(left).contains((Field) toField(parseConcat())); - } - else if (!forbidden.contains(FK_IN) && parseKeywordIf("IN")) { - Condition result; - parse('('); - if (peek(')')) - result = not - ? left instanceof Field - ? ((Field) left).notIn(EMPTY_FIELD) - : new RowInCondition((Row) left, new QueryPartList<>(), true) - : left instanceof Field - ? ((Field) left).in(EMPTY_FIELD) - : new RowInCondition((Row) left, new QueryPartList<>(), false); - else if (peekSelectOrWith(true)) - result = not - ? left instanceof Field - ? ((Field) left).notIn(parseWithOrSelect(1)) - : new RowSubqueryCondition((Row) left, parseWithOrSelect(((Row) left).size()), NOT_IN) - : left instanceof Field - ? ((Field) left).in(parseWithOrSelect(1)) - : new RowSubqueryCondition((Row) left, parseWithOrSelect(((Row) left).size()), IN); - else - result = not - ? left instanceof Field - ? ((Field) left).notIn(parseList(',', c -> c.parseField())) - : new RowInCondition((Row) left, new QueryPartList<>(parseList(',', c -> parseRow(((Row) left).size()))), true) - : left instanceof Field - ? ((Field) left).in(parseList(',', c -> c.parseField())) - : new RowInCondition((Row) left, new QueryPartList<>(parseList(',', c -> parseRow(((Row) left).size()))), false); - - parse(')'); - return result; - } - else if (parseKeywordIf("BETWEEN")) { - boolean symmetric = !parseKeywordIf("ASYMMETRIC") && parseKeywordIf("SYMMETRIC"); - FieldOrRow r1 = left instanceof Field - ? parseConcat() - : parseRow(((Row) left).size()); - parseKeyword("AND"); - FieldOrRow r2 = left instanceof Field - ? parseConcat() - : parseRow(((Row) left).size()); - - return symmetric - ? not - ? left instanceof Field - ? ((Field) left).notBetweenSymmetric((Field) r1, (Field) r2) - : new RowBetweenCondition((Row) left, (Row) r1, not, symmetric, (Row) r2) - : left instanceof Field - ? ((Field) left).betweenSymmetric((Field) r1, (Field) r2) - : new RowBetweenCondition((Row) left, (Row) r1, not, symmetric, (Row) r2) - : not - ? left instanceof Field - ? ((Field) left).notBetween((Field) r1, (Field) r2) - : new RowBetweenCondition((Row) left, (Row) r1, not, symmetric, (Row) r2) - : left instanceof Field - ? ((Field) left).between((Field) r1, (Field) r2) - : new RowBetweenCondition((Row) left, (Row) r1, not, symmetric, (Row) r2); - } - else if (left instanceof Field && (parseKeywordIf("LIKE") || parseOperatorIf("~~") || (notOp = parseOperatorIf("!~~")))) { - if (parseKeywordIf("ANY")) { - parse('('); - if (peekSelectOrWith(true)) { - Select select = parseWithOrSelect(); - parse(')'); - LikeEscapeStep result = (not ^ notOp) ? ((Field) left).notLike(any(select)) : ((Field) left).like(any(select)); - return parseEscapeClauseIf(result); - } - else { - List> fields; - if (parseIf(')')) { - fields = emptyList(); - } - else { - fields = parseList(',', c -> toField(parseConcat())); - parse(')'); - } - Field[] fieldArray = fields.toArray(new Field[0]); - LikeEscapeStep result = (not ^ notOp) ? ((Field) left).notLike(any(fieldArray)) : ((Field) left).like(any(fieldArray)); - return parseEscapeClauseIf(result); - } - } - else if (parseKeywordIf("ALL")) { - parse('('); - if (peekSelectOrWith(true)) { - Select select = parseWithOrSelect(); - parse(')'); - LikeEscapeStep result = (not ^ notOp) ? ((Field) left).notLike(all(select)) : ((Field) left).like(all(select)); - return parseEscapeClauseIf(result); - } - else { - List> fields; - if (parseIf(')')) { - fields = emptyList(); - } - else { - fields = parseList(',', c -> toField(parseConcat())); - parse(')'); - } - Field[] fieldArray = fields.toArray(new Field[0]); - LikeEscapeStep result = (not ^ notOp) ? ((Field) left).notLike(all(fieldArray)) : ((Field) left).like(all(fieldArray)); - return parseEscapeClauseIf(result); - } - } - else { - Field right = toField(parseConcat()); - LikeEscapeStep like = (not ^ notOp) ? ((Field) left).notLike(right) : ((Field) left).like(right); - return parseEscapeClauseIf(like); - } - } - else if (left instanceof Field && (parseKeywordIf("ILIKE") || parseOperatorIf("~~*") || (notOp = parseOperatorIf("!~~*")))) { - Field right = toField(parseConcat()); - LikeEscapeStep like = (not ^ notOp) ? ((Field) left).notLikeIgnoreCase(right) : ((Field) left).likeIgnoreCase(right); - return parseEscapeClauseIf(like); - } - else if (left instanceof Field && (parseKeywordIf("REGEXP") - || parseKeywordIf("RLIKE") - || parseKeywordIf("LIKE_REGEX") - || parseOperatorIf("~") - || (notOp = parseOperatorIf("!~")))) { - Field right = toField(parseConcat()); - return (not ^ notOp) - ? ((Field) left).notLikeRegex(right) - : ((Field) left).likeRegex(right); - } - else if (left instanceof Field && parseKeywordIf("SIMILAR TO")) { - Field right = toField(parseConcat()); - LikeEscapeStep like = not ? ((Field) left).notSimilarTo(right) : ((Field) left).similarTo(right); - return parseEscapeClauseIf(like); - } - else if (left instanceof Row && ((Row) left).size() == 2 && parseKeywordIf("OVERLAPS")) { - Row leftRow = (Row) left; - Row rightRow = parseRow(2); - - Row2 leftRow2 = row(leftRow.field(0), leftRow.field(1)); - Row2 rightRow2 = row(rightRow.field(0), rightRow.field(1)); - - return leftRow2.overlaps(rightRow2); - } - else - return left; - } + return null; } private final QueryPart parseEscapeClauseIf(LikeEscapeStep like) { @@ -7614,6 +7695,18 @@ final class DefaultParseContext extends AbstractScope implements ParseContext { + + + + + + + + + + + + @@ -8212,6 +8305,11 @@ final class DefaultParseContext extends AbstractScope implements ParseContext { + } + else if (parseFunctionNameIf("ST_INTERSECTION") && requireProEdition()) { + + + } else if (parseFunctionNameIf("ST_LENGTH") && requireProEdition()) { @@ -8232,6 +8330,11 @@ final class DefaultParseContext extends AbstractScope implements ParseContext { + } + else if (parseFunctionNameIf("ST_UNION") && requireProEdition()) { + + + } else if (parseFunctionNameIf("ST_X") && requireProEdition()) { diff --git a/jOOQ/src/main/java/org/jooq/impl/QOM.java b/jOOQ/src/main/java/org/jooq/impl/QOM.java index af1eb928f4..93128ad86a 100644 --- a/jOOQ/src/main/java/org/jooq/impl/QOM.java +++ b/jOOQ/src/main/java/org/jooq/impl/QOM.java @@ -3559,6 +3559,82 @@ public final class QOM { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jOOQ/src/main/java/org/jooq/impl/StIntersection.java b/jOOQ/src/main/java/org/jooq/impl/StIntersection.java new file mode 100644 index 0000000000..255d7e8f08 --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/impl/StIntersection.java @@ -0,0 +1,191 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Other licenses: + * ----------------------------------------------------------------------------- + * Commercial licenses for this work are available. These replace the above + * ASL 2.0 and offer limited warranties, support, maintenance, and commercial + * database integrations. + * + * For more information, please visit: http://www.jooq.org/licenses + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +package org.jooq.impl; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jOOQ/src/main/java/org/jooq/impl/StIntersects.java b/jOOQ/src/main/java/org/jooq/impl/StIntersects.java new file mode 100644 index 0000000000..91b38ac18a --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/impl/StIntersects.java @@ -0,0 +1,187 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Other licenses: + * ----------------------------------------------------------------------------- + * Commercial licenses for this work are available. These replace the above + * ASL 2.0 and offer limited warranties, support, maintenance, and commercial + * database integrations. + * + * For more information, please visit: http://www.jooq.org/licenses + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +package org.jooq.impl; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jOOQ/src/main/java/org/jooq/impl/StIsClosed.java b/jOOQ/src/main/java/org/jooq/impl/StIsClosed.java new file mode 100644 index 0000000000..5c89fcd75c --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/impl/StIsClosed.java @@ -0,0 +1,169 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Other licenses: + * ----------------------------------------------------------------------------- + * Commercial licenses for this work are available. These replace the above + * ASL 2.0 and offer limited warranties, support, maintenance, and commercial + * database integrations. + * + * For more information, please visit: http://www.jooq.org/licenses + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +package org.jooq.impl; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jOOQ/src/main/java/org/jooq/impl/StOverlaps.java b/jOOQ/src/main/java/org/jooq/impl/StOverlaps.java new file mode 100644 index 0000000000..91b38ac18a --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/impl/StOverlaps.java @@ -0,0 +1,187 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Other licenses: + * ----------------------------------------------------------------------------- + * Commercial licenses for this work are available. These replace the above + * ASL 2.0 and offer limited warranties, support, maintenance, and commercial + * database integrations. + * + * For more information, please visit: http://www.jooq.org/licenses + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +package org.jooq.impl; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jOOQ/src/main/java/org/jooq/impl/StTouches.java b/jOOQ/src/main/java/org/jooq/impl/StTouches.java new file mode 100644 index 0000000000..91b38ac18a --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/impl/StTouches.java @@ -0,0 +1,187 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Other licenses: + * ----------------------------------------------------------------------------- + * Commercial licenses for this work are available. These replace the above + * ASL 2.0 and offer limited warranties, support, maintenance, and commercial + * database integrations. + * + * For more information, please visit: http://www.jooq.org/licenses + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +package org.jooq.impl; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jOOQ/src/main/java/org/jooq/impl/StUnion.java b/jOOQ/src/main/java/org/jooq/impl/StUnion.java new file mode 100644 index 0000000000..6dfc01ae15 --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/impl/StUnion.java @@ -0,0 +1,198 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Other licenses: + * ----------------------------------------------------------------------------- + * Commercial licenses for this work are available. These replace the above + * ASL 2.0 and offer limited warranties, support, maintenance, and commercial + * database integrations. + * + * For more information, please visit: http://www.jooq.org/licenses + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +package org.jooq.impl; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +