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 cc0def8 Fix POSTGRESQL_TYPE_CHAR not found in column type (#10704)
cc0def8 is described below
commit cc0def8cb09314f4dff56f99eaa3d680344fe6ce
Author: 吴伟杰 <[email protected]>
AuthorDate: Mon Jun 7 19:39:04 2021 +0800
Fix POSTGRESQL_TYPE_CHAR not found in column type (#10704)
* Fix POSTGRESQL_TYPE_CHAR not found in column type
* Complete test case
---
.../bind/protocol/PostgreSQLBinaryProtocolValueFactory.java | 1 +
.../bind/protocol/PostgreSQLBinaryProtocolValueFactoryTest.java | 8 +++++++-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git
a/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/binary/bind/protocol/PostgreSQLBinaryProtocolValueFactory.java
b/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/binary/bind/protocol/PostgreSQLBinaryProtocolValueFactory.java
index e97b41d..273fb6e 100644
---
a/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/binary/bind/protocol/PostgreSQLBinaryProtocolValueFactory.java
+++
b/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/binary/bind/protocol/PostgreSQLBinaryProtocolValueFactory.java
@@ -62,6 +62,7 @@ public final class PostgreSQLBinaryProtocolValueFactory {
private static void setStringLenencBinaryProtocolValue() {
PostgreSQLStringBinaryProtocolValue binaryProtocolValue = new
PostgreSQLStringBinaryProtocolValue();
BINARY_PROTOCOL_VALUES.put(PostgreSQLBinaryColumnType.POSTGRESQL_TYPE_VARCHAR,
binaryProtocolValue);
+
BINARY_PROTOCOL_VALUES.put(PostgreSQLBinaryColumnType.POSTGRESQL_TYPE_CHAR,
binaryProtocolValue);
}
private static void setInt8BinaryProtocolValue() {
diff --git
a/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/binary/bind/protocol/PostgreSQLBinaryProtocolValueFactoryTest.java
b/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/binary/bind/protocol/PostgreSQLBinaryProtocolValueFactoryTest.java
index f819cfe..db0fd23 100644
---
a/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/binary/bind/protocol/PostgreSQLBinaryProtocolValueFactoryTest.java
+++
b/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/binary/bind/protocol/PostgreSQLBinaryProtocolValueFactoryTest.java
@@ -26,12 +26,18 @@ import static org.junit.Assert.assertThat;
public final class PostgreSQLBinaryProtocolValueFactoryTest {
@Test
- public void assertGetStringBinaryProtocolValue() {
+ public void assertGetStringBinaryProtocolValueByVarchar() {
PostgreSQLBinaryProtocolValue binaryProtocolValue =
PostgreSQLBinaryProtocolValueFactory.getBinaryProtocolValue(PostgreSQLBinaryColumnType.POSTGRESQL_TYPE_VARCHAR);
assertThat(binaryProtocolValue,
instanceOf(PostgreSQLStringBinaryProtocolValue.class));
}
@Test
+ public void assertGetStringBinaryProtocolValueByChar() {
+ PostgreSQLBinaryProtocolValue binaryProtocolValue =
PostgreSQLBinaryProtocolValueFactory.getBinaryProtocolValue(PostgreSQLBinaryColumnType.POSTGRESQL_TYPE_CHAR);
+ assertThat(binaryProtocolValue,
instanceOf(PostgreSQLStringBinaryProtocolValue.class));
+ }
+
+ @Test
public void assertGetInt8BinaryProtocolValue() {
PostgreSQLBinaryProtocolValue binaryProtocolValue =
PostgreSQLBinaryProtocolValueFactory.getBinaryProtocolValue(PostgreSQLBinaryColumnType.POSTGRESQL_TYPE_INT8);
assertThat(binaryProtocolValue,
instanceOf(PostgreSQLInt8BinaryProtocolValue.class));