1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.shardingsphere.distsql.parser.core.utility;
19
20 import org.apache.shardingsphere.distsql.parser.autogen.UtilityDistSQLStatementBaseVisitor;
21 import org.apache.shardingsphere.distsql.parser.autogen.UtilityDistSQLStatementParser.ParseSQLContext;
22 import org.apache.shardingsphere.distsql.parser.autogen.UtilityDistSQLStatementParser.PreviewSQLContext;
23 import org.apache.shardingsphere.distsql.statement.type.rul.sql.ParseStatement;
24 import org.apache.shardingsphere.distsql.statement.type.rul.sql.PreviewStatement;
25 import org.apache.shardingsphere.sql.parser.api.ASTNode;
26 import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitor;
27
28
29
30
31 public final class UtilityDistSQLStatementVisitor extends UtilityDistSQLStatementBaseVisitor<ASTNode> implements SQLVisitor<ASTNode> {
32
33 @Override
34 public ASTNode visitPreviewSQL(final PreviewSQLContext ctx) {
35 return new PreviewStatement(ctx.sql().getText().trim());
36 }
37
38 @Override
39 public ASTNode visitParseSQL(final ParseSQLContext ctx) {
40 return new ParseStatement(ctx.sql().getText().trim());
41 }
42 }