baijun44 commented on code in PR #24405:
URL: https://github.com/apache/shardingsphere/pull/24405#discussion_r1127460419


##########
jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/statement/ShardingSpherePreparedStatement.java:
##########
@@ -653,7 +658,17 @@ public int[] executeBatch() throws SQLException {
         try {
             // TODO add raw SQL executor
             initBatchPreparedStatementExecutor();
-            return 
batchPreparedStatementExecutor.executeBatch(executionContext.getSqlStatementContext());
+            int[] results = 
batchPreparedStatementExecutor.executeBatch(executionContext.getSqlStatementContext());
+            if (statementOption.isReturnGeneratedKeys() && 
batchPreparedStatementExecutor.getStatements().size() == 1 && 
generatedValues.isEmpty()) {
+                ResultSet resultSet = 
batchPreparedStatementExecutor.getStatements().get(0).getGeneratedKeys();

Review Comment:
   I put a condition which requires statements size must equal 1. when using 
write db or single db, the statements size is 1. when using sharding mode. the 
statements size may greater than 1. In sharding mode, We almost use 
keygenerators .So I think just supporting single mode and rw mode is enough. I 
also test get all statement result in sharding mode,it can work too. but I hope 
reduce scope of influence.



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