From 2f39c572e880bd7b65f6c05e5b548853f4ffa2fa Mon Sep 17 00:00:00 2001 From: Lukas Eder Date: Fri, 12 Nov 2021 11:03:16 +0100 Subject: [PATCH] [jOOQ/jOOQ#982] Add support for GIS extensions - Added support for ST_Within --- jOOQ/src/main/java/org/jooq/impl/DSL.java | 55 ++++++ jOOQ/src/main/java/org/jooq/impl/Names.java | 1 + .../main/java/org/jooq/impl/ParserImpl.java | 37 ++-- jOOQ/src/main/java/org/jooq/impl/QOM.java | 13 ++ .../src/main/java/org/jooq/impl/StWithin.java | 187 ++++++++++++++++++ 5 files changed, 270 insertions(+), 23 deletions(-) create mode 100644 jOOQ/src/main/java/org/jooq/impl/StWithin.java diff --git a/jOOQ/src/main/java/org/jooq/impl/DSL.java b/jOOQ/src/main/java/org/jooq/impl/DSL.java index d84ded9479..d8598599bd 100644 --- a/jOOQ/src/main/java/org/jooq/impl/DSL.java +++ b/jOOQ/src/main/java/org/jooq/impl/DSL.java @@ -20621,6 +20621,61 @@ 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 a23299e80c..15eb4ff298 100644 --- a/jOOQ/src/main/java/org/jooq/impl/Names.java +++ b/jOOQ/src/main/java/org/jooq/impl/Names.java @@ -430,6 +430,7 @@ final class Names { static final Name N_ST_ASTEXT = unquotedName("st_astext"); static final Name N_ST_CONTAINS = unquotedName("st_contains"); static final Name N_ST_GEOMFROMTEXT = unquotedName("st_geomfromtext"); + 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"); static final Name N_SUBSTRING = unquotedName("substring"); diff --git a/jOOQ/src/main/java/org/jooq/impl/ParserImpl.java b/jOOQ/src/main/java/org/jooq/impl/ParserImpl.java index b221b8202c..bc166c3be6 100644 --- a/jOOQ/src/main/java/org/jooq/impl/ParserImpl.java +++ b/jOOQ/src/main/java/org/jooq/impl/ParserImpl.java @@ -306,6 +306,7 @@ 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,29 +6143,12 @@ final class DefaultParseContext extends AbstractScope implements ParseContext { - if (parseKeywordIf("EXISTS")) { - parse('('); - Select select = parseWithOrSelect(); - parse(')'); - - return exists(select); - } - else if (parseKeywordIf("REGEXP_LIKE")) { - parse('('); - Field f1 = parseField(); - parse(','); - Field f2 = parseField(); - parse(')'); - - return f1.likeRegex((Field) f2); - } - else if (parseKeywordIf("UNIQUE")) { - parse('('); - Select select = parseWithOrSelect(); - parse(')'); - - return unique(select); - } + 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")) { parse('('); Field json = parseField(); @@ -6205,6 +6189,11 @@ final class DefaultParseContext extends AbstractScope implements ParseContext { } + else if (parseFunctionNameIf("ST_WITHIN") && requireProEdition()) { + + + + } @@ -7618,6 +7607,8 @@ final class DefaultParseContext extends AbstractScope implements ParseContext { + + diff --git a/jOOQ/src/main/java/org/jooq/impl/QOM.java b/jOOQ/src/main/java/org/jooq/impl/QOM.java index 1db51c9947..4190dfd2fb 100644 --- a/jOOQ/src/main/java/org/jooq/impl/QOM.java +++ b/jOOQ/src/main/java/org/jooq/impl/QOM.java @@ -3496,6 +3496,19 @@ public final class QOM { + + + + + + + + + + + + + diff --git a/jOOQ/src/main/java/org/jooq/impl/StWithin.java b/jOOQ/src/main/java/org/jooq/impl/StWithin.java new file mode 100644 index 0000000000..91b38ac18a --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/impl/StWithin.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; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +