You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by pa...@apache.org on 2023/05/13 02:32:22 UTC

[shardingsphere] branch master updated: Fix sonar issue for PostgreSQLAggregatedBatchedStatementsCommandExecutor (#25634)

This is an automated email from the ASF dual-hosted git repository.

panjuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 1141b2ac95f Fix sonar issue for PostgreSQLAggregatedBatchedStatementsCommandExecutor (#25634)
1141b2ac95f is described below

commit 1141b2ac95f8f84b7f65644a3e27960d5d6e3ef9
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Sat May 13 10:32:06 2023 +0800

    Fix sonar issue for PostgreSQLAggregatedBatchedStatementsCommandExecutor (#25634)
---
 .../extended/PostgreSQLAggregatedBatchedStatementsCommandExecutor.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/PostgreSQLAggregatedBatchedStatementsCommandExecutor.java b/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/PostgreSQLAggregatedBatchedStatementsCommandExecutor.java
index 86fa9f6646f..e6ed7d0a449 100644
--- a/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/PostgreSQLAggregatedBatchedStatementsCommandExecutor.java
+++ b/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/PostgreSQLAggregatedBatchedStatementsCommandExecutor.java
@@ -63,7 +63,7 @@ public final class PostgreSQLAggregatedBatchedStatementsCommandExecutor implemen
             }
             if (each instanceof PostgreSQLComExecutePacket) {
                 String tag = PostgreSQLCommand.valueOf(preparedStatement.getSqlStatementContext().getSqlStatement().getClass()).orElse(PostgreSQLCommand.INSERT).getTag();
-                result.add(new PostgreSQLCommandCompletePacket(tag, totalInserted / executePacketCount));
+                result.add(new PostgreSQLCommandCompletePacket(tag, 0 == executePacketCount ? 1 : totalInserted / executePacketCount));
             }
         }
         return result;