[#8187] Add support for CONTINUE [ WHEN ] in procedural blocks

This commit is contained in:
lukaseder 2019-01-08 16:39:27 +01:00
parent e5e1d22669
commit 844594134c
6 changed files with 121 additions and 1 deletions

View File

@ -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 ]
;

View File

@ -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;

View File

@ -9831,6 +9831,24 @@ public class DSL {

View File

@ -69,5 +69,6 @@ package org.jooq.impl;

View File

@ -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");

View File

@ -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 {