From 844594134cf7944076acd444a3b83dd509f52cc5 Mon Sep 17 00:00:00 2001 From: lukaseder Date: Tue, 8 Jan 2019 16:39:27 +0100 Subject: [PATCH] [#8187] Add support for CONTINUE [ WHEN ] in procedural blocks --- .../resources/org/jooq/web/grammar-3.12.txt | 5 ++ .../src/main/java/org/jooq/impl/Continue.java | 74 +++++++++++++++++++ jOOQ/src/main/java/org/jooq/impl/DSL.java | 18 +++++ jOOQ/src/main/java/org/jooq/impl/Exit.java | 1 + .../src/main/java/org/jooq/impl/Keywords.java | 1 + .../main/java/org/jooq/impl/ParserImpl.java | 23 +++++- 6 files changed, 121 insertions(+), 1 deletion(-) create mode 100644 jOOQ/src/main/java/org/jooq/impl/Continue.java diff --git a/jOOQ-manual/src/main/resources/org/jooq/web/grammar-3.12.txt b/jOOQ-manual/src/main/resources/org/jooq/web/grammar-3.12.txt index 55bace47f8..9dd01cb863 100644 --- a/jOOQ-manual/src/main/resources/org/jooq/web/grammar-3.12.txt +++ b/jOOQ-manual/src/main/resources/org/jooq/web/grammar-3.12.txt @@ -53,6 +53,7 @@ proceduralStatement = | ifStatement | loopStatement | whileStatement +| continueStatement | exitStatement | nullStatement ; @@ -91,6 +92,10 @@ whileStatement = 'WHILE' condition 'LOOP' proceduralStatements 'END LOOP' ; +continueStatement = + 'CONTINUE' [ 'WHEN' condition ] +; + exitStatement = 'EXIT' [ 'WHEN' condition ] ; diff --git a/jOOQ/src/main/java/org/jooq/impl/Continue.java b/jOOQ/src/main/java/org/jooq/impl/Continue.java new file mode 100644 index 0000000000..e5e905ca7a --- /dev/null +++ b/jOOQ/src/main/java/org/jooq/impl/Continue.java @@ -0,0 +1,74 @@ +/* + * 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/DSL.java b/jOOQ/src/main/java/org/jooq/impl/DSL.java index 4187acb105..1b346c5807 100644 --- a/jOOQ/src/main/java/org/jooq/impl/DSL.java +++ b/jOOQ/src/main/java/org/jooq/impl/DSL.java @@ -9831,6 +9831,24 @@ public class DSL { + + + + + + + + + + + + + + + + + + diff --git a/jOOQ/src/main/java/org/jooq/impl/Exit.java b/jOOQ/src/main/java/org/jooq/impl/Exit.java index b822987d92..e5e905ca7a 100644 --- a/jOOQ/src/main/java/org/jooq/impl/Exit.java +++ b/jOOQ/src/main/java/org/jooq/impl/Exit.java @@ -69,5 +69,6 @@ package org.jooq.impl; + diff --git a/jOOQ/src/main/java/org/jooq/impl/Keywords.java b/jOOQ/src/main/java/org/jooq/impl/Keywords.java index c059161ad5..fa65624eb3 100644 --- a/jOOQ/src/main/java/org/jooq/impl/Keywords.java +++ b/jOOQ/src/main/java/org/jooq/impl/Keywords.java @@ -85,6 +85,7 @@ final class Keywords { static final Keyword K_COMMENT = keyword("comment"); static final Keyword K_CONNECT_BY = keyword("connect by"); static final Keyword K_CONSTRAINT = keyword("constraint"); + static final Keyword K_CONTINUE = keyword("continue"); static final Keyword K_CONTINUE_IDENTITY = keyword("continue identity"); static final Keyword K_CREATE = keyword("create"); static final Keyword K_CREATE_SCHEMA = keyword("create schema"); diff --git a/jOOQ/src/main/java/org/jooq/impl/ParserImpl.java b/jOOQ/src/main/java/org/jooq/impl/ParserImpl.java index 3ccf8a7595..eff504435d 100644 --- a/jOOQ/src/main/java/org/jooq/impl/ParserImpl.java +++ b/jOOQ/src/main/java/org/jooq/impl/ParserImpl.java @@ -76,6 +76,8 @@ import static org.jooq.impl.DSL.collation; import static org.jooq.impl.DSL.concat; import static org.jooq.impl.DSL.condition; import static org.jooq.impl.DSL.constraint; +import static org.jooq.impl.DSL.continueWhen; +import static org.jooq.impl.DSL.continue_; import static org.jooq.impl.DSL.cos; import static org.jooq.impl.DSL.cosh; import static org.jooq.impl.DSL.cot; @@ -145,7 +147,7 @@ import static org.jooq.impl.DSL.list; import static org.jooq.impl.DSL.listAgg; import static org.jooq.impl.DSL.ln; import static org.jooq.impl.DSL.log; -import static org.jooq.impl.DSL.loop; +// ... import static org.jooq.impl.DSL.lower; import static org.jooq.impl.DSL.lpad; import static org.jooq.impl.DSL.ltrim; @@ -2246,6 +2248,16 @@ final class ParserImpl implements Parser { private static final Statement parseStatement(ParserContext ctx) { switch (ctx.character()) { + case 'c': + case 'C': + if (peekKeyword(ctx, "CONTINUE") && ctx.requireProEdition()) + + + + ; + + break; + case 'd': case 'D': if (peekKeyword(ctx, "DECLARE") && ctx.requireProEdition()) @@ -2428,6 +2440,15 @@ final class ParserImpl implements Parser { + + + + + + + + +