FlyingZC commented on code in PR #22492:
URL: https://github.com/apache/shardingsphere/pull/22492#discussion_r1034250686


##########
sql-parser/dialect/postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/statement/impl/PostgreSQLTCLStatementSQLVisitor.java:
##########
@@ -68,7 +71,40 @@ public PostgreSQLTCLStatementSQLVisitor(final Properties 
props) {
     
     @Override
     public ASTNode visitSetTransaction(final SetTransactionContext ctx) {
-        return new PostgreSQLSetTransactionStatement();
+        PostgreSQLSetTransactionStatement result = new 
PostgreSQLSetTransactionStatement();
+        if (null != ctx.transactionModeList()) {
+            ctx.transactionModeList().transactionModeItem().forEach(each -> {
+                setTransactionAccessType(result, each);
+                setTransactionIsolationLevel(result, each);
+            });
+        }
+        return result;
+    }
+    
+    private void setTransactionAccessType(final 
PostgreSQLSetTransactionStatement statement, final TransactionModeItemContext 
modeItemContext) {
+        TransactionAccessType accessType = null;
+        if (null != modeItemContext.ONLY()) {
+            accessType = TransactionAccessType.READ_ONLY;
+        } else if (null != modeItemContext.WRITE()) {
+            accessType = TransactionAccessType.READ_WRITE;
+        }
+        statement.setAccessMode(accessType);
+    }
+    
+    private void setTransactionIsolationLevel(final 
PostgreSQLSetTransactionStatement statement, final TransactionModeItemContext 
modeItemContext) {

Review Comment:
   OK.



-- 
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: notifications-unsubscr...@shardingsphere.apache.org

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

Reply via email to