You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2020/12/16 02:48:09 UTC

[GitHub] [shardingsphere] tristaZero commented on a change in pull request #8622: Refactor VisitorEngine

tristaZero commented on a change in pull request #8622:
URL: https://github.com/apache/shardingsphere/pull/8622#discussion_r543851898



##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/format/impl/MySQLFormatSQLVisitor.java
##########
@@ -68,24 +69,42 @@
 import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.WhereClauseContext;
 import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.WithClauseContext;
 
+import java.util.Properties;
+
 /**
  * MySQL Format SQL visitor for MySQL.
  */
+@NoArgsConstructor
 @Getter
 @Setter
 public abstract class MySQLFormatSQLVisitor extends MySQLStatementBaseVisitor<String> {
 
     private StringBuilder result = new StringBuilder();
 
-    private boolean uperCase = true;
+    private boolean upperCase = true;
 
     private boolean parameterized = true;
 
     private int indentCount;
 
     private int lines;
 
-    private final int projectionsCountOfLine = 3;
+    private int projectionsCountOfLine = 3;
+
+    MySQLFormatSQLVisitor(final Properties props) {

Review comment:
       public class or protected one?

##########
File path: shardingsphere-infra/shardingsphere-infra-parser/src/main/java/org/apache/shardingsphere/infra/parser/sql/SQLStatementParserExecutor.java
##########
@@ -32,7 +32,7 @@
     
     public SQLStatementParserExecutor(final String databaseType) {
         parserEngine = new SQLParserEngine(databaseType);
-        visitorEngine = new SQLVisitorEngine(databaseType, "STATEMENT");
+        visitorEngine = new SQLVisitorEngine(databaseType, "STATEMENT", null);

Review comment:
       Maybe `new Properties()` is better.

##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/format/impl/MySQLFormatSQLVisitor.java
##########
@@ -68,24 +69,42 @@
 import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.WhereClauseContext;
 import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.WithClauseContext;
 
+import java.util.Properties;
+
 /**
  * MySQL Format SQL visitor for MySQL.
  */
+@NoArgsConstructor
 @Getter
 @Setter
 public abstract class MySQLFormatSQLVisitor extends MySQLStatementBaseVisitor<String> {
 
     private StringBuilder result = new StringBuilder();
 
-    private boolean uperCase = true;
+    private boolean upperCase = true;
 
     private boolean parameterized = true;
 
     private int indentCount;
 
     private int lines;
 
-    private final int projectionsCountOfLine = 3;
+    private int projectionsCountOfLine = 3;
+
+    MySQLFormatSQLVisitor(final Properties props) {
+        this();

Review comment:
       Is it necessary?

##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/statement/impl/PostgreSQLStatementSQLVisitor.java
##########
@@ -93,15 +94,21 @@
 import java.util.Collection;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.Properties;
 
 /**
  * PostgreSQL Statement SQL visitor.
  */
+@NoArgsConstructor
 @Getter(AccessLevel.PROTECTED)
 public abstract class PostgreSQLStatementSQLVisitor extends PostgreSQLStatementBaseVisitor<ASTNode> {
     
     private int currentParameterIndex;
-    
+
+    public PostgreSQLStatementSQLVisitor(final Properties props) {
+        this();

Review comment:
       Is this necessary?




----------------------------------------------------------------
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.

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