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 2022/10/09 08:48:19 UTC

[GitHub] [shardingsphere] FlyingZC commented on a diff in pull request #20726: When xa is enabled, batch operations automatically support transactions

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


##########
shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/JDBCDatabaseCommunicationEngine.java:
##########
@@ -127,12 +133,33 @@ public ResponseHeader execute() throws SQLException {
             return new UpdateResponseHeader(executionContext.getSqlStatementContext().getSqlStatement());
         }
         proxySQLExecutor.checkExecutePrerequisites(executionContext);
-        List result = proxySQLExecutor.execute(executionContext);
-        refreshMetaData(executionContext);
-        Object executeResultSample = result.iterator().next();
-        return executeResultSample instanceof QueryResult
-                ? processExecuteQuery(executionContext, result, (QueryResult) executeResultSample)
-                : processExecuteUpdate(executionContext, result);
+        TransactionStatus transactionStatus = backendConnection.getConnectionSession().getTransactionStatus();
+        SQLStatement sqlStatement = executionContext.getSqlStatementContext().getSqlStatement();
+        JDBCBackendTransactionManager transactionManager = null;
+        if (TransactionType.XA == transactionStatus.getTransactionType() && transactionStatus.isInTransaction()

Review Comment:
   Maybe not in the transaction `!transactionStatus.isInTransaction()` and then auto start the transaction.



-- 
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-unsubscribe@shardingsphere.apache.org

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