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



##########
File path: 
shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/segment/tcl/dialect/mysql/TransactionCharacteristicSegment.java
##########
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.sql.parser.sql.segment.tcl.dialect.mysql;
+
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.shardingsphere.sql.parser.sql.segment.SQLSegment;
+
+@Setter
+@Getter
+public class TransactionCharacteristicSegment implements SQLSegment {

Review comment:
       Final?

##########
File path: 
shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/tcl/dialect/mysql/MysqlSetTransactionStatement.java
##########
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.sql.parser.sql.statement.tcl.dialect.mysql;
+
+import lombok.Getter;
+import lombok.Setter;
+import 
org.apache.shardingsphere.sql.parser.sql.segment.tcl.dialect.mysql.TransactionCharacteristicSegment;
+import 
org.apache.shardingsphere.sql.parser.sql.statement.tcl.SetTransactionStatement;
+
+import java.util.Collection;
+import java.util.LinkedList;
+
+@Getter
+@Setter
+public final class MysqlSetTransactionStatement extends 
SetTransactionStatement {

Review comment:
       Do other DBs need similar classes?

##########
File path: 
shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/statement/tcl/SetTransactionStatement.java
##########
@@ -20,5 +20,5 @@
 /**
  * Set transaction statement.
  */
-public final class SetTransactionStatement extends TCLStatement {
+public class SetTransactionStatement extends TCLStatement {

Review comment:
       Is it necessary to create child classes?

##########
File path: 
shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/antlr4/imports/mysql/TCLStatement.g4
##########
@@ -50,4 +50,16 @@ rollback
 
 savepoint
     : SAVEPOINT
-    ;
\ No newline at end of file
+    ;
+
+transactionCharacteristic_

Review comment:
       If you need to visit `transactionCharacteristic_ `, please rename it to 
`transactionCharacteristic`.
   It is also necessary to check other rule names. 

##########
File path: sharding-sql-test/src/main/resources/sql/supported/tcl/tcl.xml
##########
@@ -38,7 +38,7 @@
     <sql-case id="rollbackToSavepoint" value="ROLLBACK TO savepoint1" />
     <sql-case id="setGlobalTransaction" value="SET GLOBAL TRANSACTION 
ISOLATION LEVEL REPEATABLE READ" />
     <sql-case id="setTransactionReadOnly" value="SET TRANSACTION READ ONLY" 
db-types="MySQL,Oracle,PostgreSQL" />
-    <sql-case id="setTransactionWithName" value="SET TRANSACTION NAME 
'comment1'" />
+    <sql-case id="setTransactionWithName" value="SET TRANSACTION NAME 
'comment1'" db-types="Oracle,PostgreSQL,SQLServer"/>

Review comment:
       A blank space ahead of `/>` is needed.




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


Reply via email to