You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by me...@apache.org on 2021/06/10 07:04:37 UTC
[shardingsphere] branch master updated: PostgreSQL
CommandCompletion return actual rows (#10748)
This is an automated email from the ASF dual-hosted git repository.
menghaoran 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 7a1a2b4 PostgreSQL CommandCompletion return actual rows (#10748)
7a1a2b4 is described below
commit 7a1a2b422aec8a6f2982b0f43c48f653008dd6c1
Author: 吴伟杰 <wu...@apache.org>
AuthorDate: Thu Jun 10 15:03:52 2021 +0800
PostgreSQL CommandCompletion return actual rows (#10748)
---
.../command/query/binary/execute/PostgreSQLComExecuteExecutor.java | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/binary/execute/PostgreSQLComExecuteExecutor.java b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/binary/execute/PostgreSQLComExecuteExecutor.java
index 053f318..1e4ba7e 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/binary/execute/PostgreSQLComExecuteExecutor.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/binary/execute/PostgreSQLComExecuteExecutor.java
@@ -46,6 +46,8 @@ public final class PostgreSQLComExecuteExecutor implements QueryCommandExecutor
private final Collection<QueryCommandExecutor> queryCommandExecutors = new LinkedList<>();
+ private long dataRows;
+
private boolean commandComplete;
@Override
@@ -75,6 +77,7 @@ public final class PostgreSQLComExecuteExecutor implements QueryCommandExecutor
public DatabasePacket<?> getQueryRowPacket() throws SQLException {
Optional<DatabasePacket<?>> result = getPacketFromQueryCommandExecutors();
if (result.isPresent()) {
+ dataRows++;
return result.get();
}
return createCommandCompletePacket();
@@ -86,7 +89,7 @@ public final class PostgreSQLComExecuteExecutor implements QueryCommandExecutor
return new PostgreSQLEmptyQueryResponsePacket();
}
String sqlCommand = connectionContext.getSqlStatement().map(SQLStatement::getClass).map(PostgreSQLCommand::valueOf).map(command -> command.map(Enum::name).orElse("")).orElse("");
- PostgreSQLCommandCompletePacket result = new PostgreSQLCommandCompletePacket(sqlCommand, connectionContext.getUpdateCount());
+ PostgreSQLCommandCompletePacket result = new PostgreSQLCommandCompletePacket(sqlCommand, Math.max(dataRows, connectionContext.getUpdateCount()));
connectionContext.clearContext();
return result;
}