terrymanu commented on a change in pull request #14983:
URL: https://github.com/apache/shardingsphere/pull/14983#discussion_r790608610



##########
File path: 
shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/constant/TransactionIsolationLevel.java
##########
@@ -0,0 +1,37 @@
+/*
+ * 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.common.constant;
+
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+
+/**
+ * Transaction isolation level enum.
+ */
+@RequiredArgsConstructor
+@Getter
+public enum TransactionIsolationLevel {
+
+    NONE("NONE"),
+    REPEATABLE_READ("REPEATABLE_READ"),
+    READ_UNCOMMITTED("READ_UNCOMMITTED"),
+    SERIALIZABLE("SERIALIZABLE"),
+    READ_COMMITTED("READ_COMMITTED");

Review comment:
       Please change the sequence to READ_UNCOMMITTED, READ_COMMITTED, 
REPEATABLE_READ, SERIALIZABLE

##########
File path: 
shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/util/TransactionUtil.java
##########
@@ -0,0 +1,73 @@
+/*
+ * 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.proxy.backend.util;
+
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import 
org.apache.shardingsphere.sql.parser.sql.common.constant.TransactionIsolationLevel;
+
+import java.sql.Connection;
+
+/**
+ * Transaction util class.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class TransactionUtil {
+
+    /**
+     * Get the value of type int according to TransactionIsolationLevel.
+     *
+     * @param isolationLevel TransactionIsolationLevel type
+     * @return isolationLevel
+     */
+    public static int getTransactionIsolationLevel(final 
TransactionIsolationLevel isolationLevel) {
+        switch (isolationLevel) {
+            case READ_UNCOMMITTED:
+                return Connection.TRANSACTION_READ_UNCOMMITTED;
+            case READ_COMMITTED:
+                return Connection.TRANSACTION_READ_COMMITTED;
+            case REPEATABLE_READ:
+                return Connection.TRANSACTION_REPEATABLE_READ;
+            case SERIALIZABLE:
+                return Connection.TRANSACTION_SERIALIZABLE;
+            default:
+                return Connection.TRANSACTION_NONE;
+        }
+    }
+
+    /**
+     * Get the value of type TransactionIsolationLevel according to int.
+     *
+     * @param isolationLevel int type

Review comment:
       The `int type` of java doc is incorrect.

##########
File path: 
shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/session/ConnectionSession.java
##########
@@ -54,7 +55,13 @@
     
     @Getter(AccessLevel.NONE)
     private final AtomicBoolean autoCommit = new AtomicBoolean(true);
-    
+
+    private boolean readOnly;

Review comment:
       Should `readOnly` keep consist with autoCommit, just use AtomicBoolean?

##########
File path: 
shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/util/TransactionUtil.java
##########
@@ -0,0 +1,73 @@
+/*
+ * 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.proxy.backend.util;
+
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import 
org.apache.shardingsphere.sql.parser.sql.common.constant.TransactionIsolationLevel;
+
+import java.sql.Connection;
+
+/**
+ * Transaction util class.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class TransactionUtil {
+
+    /**
+     * Get the value of type int according to TransactionIsolationLevel.
+     *
+     * @param isolationLevel TransactionIsolationLevel type
+     * @return isolationLevel
+     */
+    public static int getTransactionIsolationLevel(final 
TransactionIsolationLevel isolationLevel) {
+        switch (isolationLevel) {
+            case READ_UNCOMMITTED:
+                return Connection.TRANSACTION_READ_UNCOMMITTED;
+            case READ_COMMITTED:
+                return Connection.TRANSACTION_READ_COMMITTED;
+            case REPEATABLE_READ:
+                return Connection.TRANSACTION_REPEATABLE_READ;
+            case SERIALIZABLE:
+                return Connection.TRANSACTION_SERIALIZABLE;
+            default:
+                return Connection.TRANSACTION_NONE;
+        }
+    }
+
+    /**
+     * Get the value of type TransactionIsolationLevel according to int.

Review comment:
       `TransactionIsolationLevel` are 3 words, please split them

##########
File path: 
shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/util/TransactionUtil.java
##########
@@ -0,0 +1,73 @@
+/*
+ * 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.proxy.backend.util;
+
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import 
org.apache.shardingsphere.sql.parser.sql.common.constant.TransactionIsolationLevel;
+
+import java.sql.Connection;
+
+/**
+ * Transaction util class.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class TransactionUtil {
+
+    /**
+     * Get the value of type int according to TransactionIsolationLevel.
+     *
+     * @param isolationLevel TransactionIsolationLevel type
+     * @return isolationLevel
+     */
+    public static int getTransactionIsolationLevel(final 
TransactionIsolationLevel isolationLevel) {
+        switch (isolationLevel) {
+            case READ_UNCOMMITTED:
+                return Connection.TRANSACTION_READ_UNCOMMITTED;
+            case READ_COMMITTED:
+                return Connection.TRANSACTION_READ_COMMITTED;
+            case REPEATABLE_READ:
+                return Connection.TRANSACTION_REPEATABLE_READ;
+            case SERIALIZABLE:
+                return Connection.TRANSACTION_SERIALIZABLE;
+            default:
+                return Connection.TRANSACTION_NONE;
+        }
+    }
+
+    /**
+     * Get the value of type TransactionIsolationLevel according to int.
+     *
+     * @param isolationLevel int type
+     * @return isolationLevel

Review comment:
       `isolationLevel` are 2 words, please do not use camel case 




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