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 e6d100a  Fix RowDescription absence when Bind binary formats (#10743)
e6d100a is described below

commit e6d100a1059f6c7cc22ebaf2cd7ffbab55c49b73
Author: 吴伟杰 <[email protected]>
AuthorDate: Wed Jun 9 20:55:05 2021 +0800

    Fix RowDescription absence when Bind binary formats (#10743)
---
 .../command/query/binary/bind/PostgreSQLComBindExecutor.java  | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/binary/bind/PostgreSQLComBindExecutor.java
 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/binary/bind/PostgreSQLComBindExecutor.java
index a815f31..90c74fc 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/binary/bind/PostgreSQLComBindExecutor.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/binary/bind/PostgreSQLComBindExecutor.java
@@ -55,7 +55,6 @@ import java.sql.SQLException;
 import java.util.Collection;
 import java.util.LinkedList;
 import java.util.List;
-import java.util.Optional;
 import java.util.stream.Collectors;
 
 /**
@@ -87,8 +86,7 @@ public final class PostgreSQLComBindExecutor implements 
QueryCommandExecutor {
         }
         ResponseHeader responseHeader = null != databaseCommunicationEngine ? 
databaseCommunicationEngine.execute() : textProtocolBackendHandler.execute();
         if (responseHeader instanceof QueryResponseHeader && 
connectionContext.getDescribeExecutor().isPresent()) {
-            getRowDescriptionPacket((QueryResponseHeader) responseHeader)
-                    .ifPresent(rowDescriptionPacket -> 
connectionContext.getDescribeExecutor().get().setRowDescriptionPacket(rowDescriptionPacket));
+            
connectionContext.getDescribeExecutor().get().setRowDescriptionPacket(getRowDescriptionPacket((QueryResponseHeader)
 responseHeader));
         }
         if (responseHeader instanceof UpdateResponseHeader) {
             responseType = ResponseType.UPDATE;
@@ -123,13 +121,10 @@ public final class PostgreSQLComBindExecutor implements 
QueryCommandExecutor {
         return sqlStatementParserEngine.parse(sql, true);
     }
     
-    private Optional<PostgreSQLRowDescriptionPacket> 
getRowDescriptionPacket(final QueryResponseHeader queryResponseHeader) {
-        if (packet.isBinaryRowData()) {
-            return Optional.empty();
-        }
+    private PostgreSQLRowDescriptionPacket getRowDescriptionPacket(final 
QueryResponseHeader queryResponseHeader) {
         responseType = ResponseType.QUERY;
         Collection<PostgreSQLColumnDescription> columnDescriptions = 
createColumnDescriptions(queryResponseHeader);
-        return Optional.of(new 
PostgreSQLRowDescriptionPacket(columnDescriptions.size(), columnDescriptions));
+        return new PostgreSQLRowDescriptionPacket(columnDescriptions.size(), 
columnDescriptions);
     }
     
     private Collection<PostgreSQLColumnDescription> 
createColumnDescriptions(final QueryResponseHeader queryResponseHeader) {

Reply via email to