strongduanmu commented on a change in pull request #15619:
URL: https://github.com/apache/shardingsphere/pull/15619#discussion_r814406924



##########
File path: 
shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/impl/MySQLDALStatementSQLVisitor.java
##########
@@ -974,13 +974,15 @@ private VariableAssignSegment getVariableAssign(final 
OptionValueContext ctx) {
     
     @Override
     public ASTNode visitSetCharacter(final SetCharacterContext ctx) {
-        MySQLSetStatement result = new MySQLSetStatement();
+        final MySQLSetStatement result = new MySQLSetStatement();

Review comment:
       @soulasuna Please remove final modifier here.

##########
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/PostgreSQLDALStatementSQLVisitor.java
##########
@@ -77,8 +77,17 @@ public ASTNode visitSet(final SetContext ctx) {
                 
variableAssignSegment.getVariable().setScope(ctx.runtimeScope().getText());
             }
             variableAssigns.add(variableAssignSegment);
-            result.getVariableAssigns().addAll(variableAssigns);
         }
+        if (null != ctx.encoding()) {
+            VariableAssignSegment variableAssignSegment = new 
VariableAssignSegment();
+            VariableSegment variableSegment = new VariableSegment();
+            variableSegment.setVariable("charset");
+            variableAssignSegment.setVariable(variableSegment);
+            String value = ctx.encoding().getText();
+            variableAssignSegment.setAssignValue(value);
+            variableAssigns.add(variableAssignSegment);
+        }
+        result.getVariableAssigns().addAll(variableAssigns);

Review comment:
       @soulasuna Can you add some sql parse test case for this logic?




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to