You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "RaigorJiang (via GitHub)" <gi...@apache.org> on 2023/09/04 06:28:31 UTC

[GitHub] [shardingsphere] RaigorJiang commented on a diff in pull request #28265: [Oracle SQL] Support parsing of XMLElement and XMLCdata Function

RaigorJiang commented on code in PR #28265:
URL: https://github.com/apache/shardingsphere/pull/28265#discussion_r1314487673


##########
parser/sql/dialect/oracle/src/main/java/org/apache/shardingsphere/sql/parser/oracle/visitor/statement/OracleStatementVisitor.java:
##########
@@ -687,11 +688,34 @@ public ASTNode visitXmlFunction(final XmlFunctionContext ctx) {
         if (null != ctx.xmlTableFunction()) {
             return visit(ctx.xmlTableFunction());
         }
+        if (null != ctx.xmlElementFunction()) {
+            return visit(ctx.xmlElementFunction());
+        }
         FunctionSegment result = new FunctionSegment(ctx.getStart().getStartIndex(), ctx.getStop().getStopIndex(), ctx.specifiedFunctionName.getText(), getOriginalText(ctx));
         result.getParameters().addAll(getExpressions(ctx.exprList()));
         return result;
     }
     
+    @Override
+    public ASTNode visitXmlElementFunction(final OracleStatementParser.XmlElementFunctionContext ctx) {

Review Comment:
   Please import context class directly.



##########
parser/sql/dialect/oracle/src/main/java/org/apache/shardingsphere/sql/parser/oracle/visitor/statement/OracleStatementVisitor.java:
##########
@@ -687,11 +688,34 @@ public ASTNode visitXmlFunction(final XmlFunctionContext ctx) {
         if (null != ctx.xmlTableFunction()) {
             return visit(ctx.xmlTableFunction());
         }
+        if (null != ctx.xmlElementFunction()) {
+            return visit(ctx.xmlElementFunction());
+        }
         FunctionSegment result = new FunctionSegment(ctx.getStart().getStartIndex(), ctx.getStop().getStopIndex(), ctx.specifiedFunctionName.getText(), getOriginalText(ctx));
         result.getParameters().addAll(getExpressions(ctx.exprList()));
         return result;
     }
     
+    @Override
+    public ASTNode visitXmlElementFunction(final OracleStatementParser.XmlElementFunctionContext ctx) {
+        XmlElementFunctionSegment result =
+                new XmlElementFunctionSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(), ctx.XMLELEMENT().getText(), (IdentifierValue) visit(ctx.identifier()), getOriginalText(ctx));
+        Collection<ExpressionSegment> expressionSegments = ctx.exprWithAlias().stream().map(each -> (ExpressionSegment) visit(each.expr())).collect(Collectors.toList());
+        result.getParameters().addAll(expressionSegments);
+        if (null != ctx.xmlAttributes()) {
+            Collection<ExpressionSegment> xmlAttributes = ctx.xmlAttributes().exprWithAlias().stream().map(each -> (ExpressionSegment) visit(each.expr())).collect(Collectors.toList());
+            result.getXmlAttributes().addAll(xmlAttributes);
+        }
+        return result;
+    }
+    
+    @Override
+    public ASTNode visitXmlCdataFunction(final OracleStatementParser.XmlCdataFunctionContext ctx) {

Review Comment:
   Please import context class directly.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org