Skip to content

Commit

Permalink
chore: Minor fix for support for CCF - SQL Whenever (#2356)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nurkambay authored Jun 27, 2024
1 parent 5dd3965 commit 6a25155
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -438,11 +438,14 @@ private ExecSqlWheneverNode.WheneverConditionType getConditionType(Db2SqlParser.
ParserRuleContext ruleContext = ((ParserRuleContext) ctx);
ExecSqlWheneverNode.WheneverConditionType conditionType = ExecSqlWheneverNode.WheneverConditionType.NOT_FOUND;


if (ruleContext.getChildCount() >= 3) {
ParseTree pt1 = ruleContext.getChild(1);
if (Objects.equals(pt1.getText(), "SQLERROR")) {
ParseTree pt = ruleContext.getChild(1);
String value = pt.getText().trim().toUpperCase();

if (Objects.equals(value, "SQLERROR")) {
conditionType = ExecSqlWheneverNode.WheneverConditionType.SQLERROR;
} else if (Objects.equals(pt1.getText(), "SQLWARNING")) {
} else if (Objects.equals(value, "SQLWARNING")) {
conditionType = ExecSqlWheneverNode.WheneverConditionType.SQLWARNING;
}
}
Expand All @@ -454,10 +457,16 @@ private Pair<ExecSqlWheneverNode.WheneverType, String> getWheneverType(Db2SqlPar
Pair<ExecSqlWheneverNode.WheneverType, String> result = Pair.of(ExecSqlWheneverNode.WheneverType.CONTINUE, null);

if (ruleContext.getChildCount() > 3) {
ParseTree pt1 = ruleContext.getChild(2);
if (Objects.equals(pt1.getText(), "DO")) {
ParseTree pt = ruleContext.getChild(2);
String value = pt.getText().trim().toUpperCase();

if (Objects.equals(value, "DO")) {
result = Pair.of(ExecSqlWheneverNode.WheneverType.DO, ruleContext.getChild(3).getText());
} else if (Objects.equals(pt1.getText(), "GO") || Objects.equals(pt1.getText(), "GOTO")) {
} else if (Objects.equals(value, "GO")) {
if (ruleContext.getChildCount() > 4) {
result = Pair.of(ExecSqlWheneverNode.WheneverType.GOTO, ruleContext.getChild(4).getText());
}
} else if (Objects.equals(value, "GOTO")) {
result = Pair.of(ExecSqlWheneverNode.WheneverType.GOTO, ruleContext.getChild(3).getText());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
{
"wheneverCondition": "SQLERROR",
"wheneverType": "GOTO",
"value": "TO",
"value": "HANDLER",
"type": "execwhenever",
"location": {
"uri": "fake/path",
Expand Down

0 comments on commit 6a25155

Please sign in to comment.