This is an automated email from the ASF dual-hosted git repository.
zhaojinchao 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 60dae43f04a Fix column length for PostgreSQLStringBinaryProtocolValue
(#35840)
60dae43f04a is described below
commit 60dae43f04a8b4fdc1530ed8dfe9b78b212f049e
Author: Raigor <[email protected]>
AuthorDate: Mon Jun 30 15:26:09 2025 +0800
Fix column length for PostgreSQLStringBinaryProtocolValue (#35840)
* Fix column length for PostgreSQLStringBinaryProtocolValue
* Update RELEASE-NOTES.md
---
RELEASE-NOTES.md | 2 ++
.../command/query/PostgreSQLDataRowPacket.java | 2 +-
.../bind/protocol/PostgreSQLBinaryProtocolValue.java | 3 ++-
.../PostgreSQLBoolArrayBinaryProtocolValue.java | 2 +-
.../protocol/PostgreSQLBoolBinaryProtocolValue.java | 2 +-
.../protocol/PostgreSQLByteaBinaryProtocolValue.java | 2 +-
.../protocol/PostgreSQLDateBinaryProtocolValue.java | 2 +-
.../PostgreSQLDoubleBinaryProtocolValue.java | 2 +-
.../PostgreSQLFloat4ArrayBinaryProtocolValue.java | 2 +-
.../PostgreSQLFloat8ArrayBinaryProtocolValue.java | 2 +-
.../protocol/PostgreSQLFloatBinaryProtocolValue.java | 2 +-
.../PostgreSQLInt2ArrayBinaryProtocolValue.java | 2 +-
.../protocol/PostgreSQLInt2BinaryProtocolValue.java | 2 +-
.../PostgreSQLInt4ArrayBinaryProtocolValue.java | 2 +-
.../protocol/PostgreSQLInt4BinaryProtocolValue.java | 2 +-
.../PostgreSQLInt8ArrayBinaryProtocolValue.java | 2 +-
.../protocol/PostgreSQLInt8BinaryProtocolValue.java | 2 +-
.../PostgreSQLNumericBinaryProtocolValue.java | 2 +-
.../PostgreSQLStringArrayBinaryProtocolValue.java | 2 +-
.../PostgreSQLStringBinaryProtocolValue.java | 7 +++++--
.../PostgreSQLTextArrayBinaryProtocolValue.java | 2 +-
.../protocol/PostgreSQLTimeBinaryProtocolValue.java | 2 +-
.../protocol/PostgreSQLUUIDBinaryProtocolValue.java | 2 +-
.../PostgreSQLUnspecifiedBinaryProtocolValue.java | 2 +-
.../PostgreSQLBoolArrayBinaryProtocolValueTest.java | 10 +++-------
.../PostgreSQLBoolBinaryProtocolValueTest.java | 2 +-
.../PostgreSQLByteaBinaryProtocolValueTest.java | 2 +-
.../PostgreSQLDateBinaryProtocolValueTest.java | 2 +-
.../PostgreSQLDoubleBinaryProtocolValueTest.java | 2 +-
...PostgreSQLFloat4ArrayBinaryProtocolValueTest.java | 10 +++-------
...PostgreSQLFloat8ArrayBinaryProtocolValueTest.java | 10 +++-------
.../PostgreSQLFloatBinaryProtocolValueTest.java | 2 +-
.../PostgreSQLInt2ArrayBinaryProtocolValueTest.java | 10 +++-------
.../PostgreSQLInt2BinaryProtocolValueTest.java | 2 +-
.../PostgreSQLInt4ArrayBinaryProtocolValueTest.java | 10 +++-------
.../PostgreSQLInt4BinaryProtocolValueTest.java | 2 +-
.../PostgreSQLInt8ArrayBinaryProtocolValueTest.java | 10 +++-------
.../PostgreSQLInt8BinaryProtocolValueTest.java | 2 +-
.../PostgreSQLNumericBinaryProtocolValueTest.java | 4 ++--
...PostgreSQLStringArrayBinaryProtocolValueTest.java | 10 +++-------
.../PostgreSQLStringBinaryProtocolValueTest.java | 20 ++++++++++++++++----
.../PostgreSQLTimeBinaryProtocolValueTest.java | 2 +-
.../PostgreSQLUUIDBinaryProtocolValueTest.java | 2 +-
...PostgreSQLUnspecifiedBinaryProtocolValueTest.java | 2 +-
44 files changed, 80 insertions(+), 90 deletions(-)
diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md
index 559859a5ba2..e19fd37e292 100644
--- a/RELEASE-NOTES.md
+++ b/RELEASE-NOTES.md
@@ -70,6 +70,8 @@
1. JDBC: Resolve statement manager leaks when creating multiple statements -
[#35665](https://github.com/apache/shardingsphere/pull/35665)
1. Kernel: Fix not return generate key when id set null -
[35783](https://github.com/apache/shardingsphere/pull/35783)
1. Encrypt: Resolve rewrite issue in nested concat function -
[35815](https://github.com/apache/shardingsphere/pull/35815)
+1. JDBC: Fix the issue where cached connections in
DriverDatabaseConnectionManager were not released in time -
[35834](https://github.com/apache/shardingsphere/pull/35834)
+1. Proxy: Fix column length for PostgreSQL string binary protocol value -
[35840](https://github.com/apache/shardingsphere/pull/35840)
### Change Logs
diff --git
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/PostgreSQLDataRowPacket.java
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/PostgreSQLDataRowPacket.java
index 97ffd7bd2e2..a42dc71cd57 100644
---
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/PostgreSQLDataRowPacket.java
+++
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/PostgreSQLDataRowPacket.java
@@ -59,7 +59,7 @@ public final class PostgreSQLDataRowPacket extends
PostgreSQLIdentifierPacket {
return;
}
PostgreSQLBinaryProtocolValue binaryProtocolValue =
PostgreSQLBinaryProtocolValueFactory.getBinaryProtocolValue(each.getColumnType());
- payload.writeInt4(binaryProtocolValue.getColumnLength(value));
+ payload.writeInt4(binaryProtocolValue.getColumnLength(payload, value));
binaryProtocolValue.write(payload, value);
}
diff --git
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBinaryProtocolValue.java
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBinaryProtocolValue.java
index 5b62831d66e..037559f6a64 100644
---
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBinaryProtocolValue.java
+++
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBinaryProtocolValue.java
@@ -27,10 +27,11 @@ public interface PostgreSQLBinaryProtocolValue {
/**
* Get column length.
*
+ * @param payload payload operation for PostgreSQL packet
* @param value value of column
* @return column length
*/
- int getColumnLength(Object value);
+ int getColumnLength(PostgreSQLPacketPayload payload, Object value);
/**
* Read binary protocol value.
diff --git
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBoolArrayBinaryProtocolValue.java
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBoolArrayBinaryProtocolValue.java
index 9927c5adaef..91959faf353 100644
---
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBoolArrayBinaryProtocolValue.java
+++
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBoolArrayBinaryProtocolValue.java
@@ -28,7 +28,7 @@ public final class PostgreSQLBoolArrayBinaryProtocolValue
implements PostgreSQLB
private static final PostgreSQLArrayParameterDecoder
ARRAY_PARAMETER_DECODER = new PostgreSQLArrayParameterDecoder();
@Override
- public int getColumnLength(final Object value) {
+ public int getColumnLength(final PostgreSQLPacketPayload payload, final
Object value) {
throw new
UnsupportedSQLOperationException("PostgreSQLBoolArrayBinaryProtocolValue.getColumnLength()");
}
diff --git
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBoolBinaryProtocolValue.java
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBoolBinaryProtocolValue.java
index 65df26ab336..78725399da4 100644
---
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBoolBinaryProtocolValue.java
+++
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBoolBinaryProtocolValue.java
@@ -27,7 +27,7 @@ import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacket
public final class PostgreSQLBoolBinaryProtocolValue implements
PostgreSQLBinaryProtocolValue {
@Override
- public int getColumnLength(final Object value) {
+ public int getColumnLength(final PostgreSQLPacketPayload payload, final
Object value) {
return 1;
}
diff --git
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLByteaBinaryProtocolValue.java
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLByteaBinaryProtocolValue.java
index 03c028608a1..a9e0cd51124 100644
---
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLByteaBinaryProtocolValue.java
+++
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLByteaBinaryProtocolValue.java
@@ -25,7 +25,7 @@ import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacket
public final class PostgreSQLByteaBinaryProtocolValue implements
PostgreSQLBinaryProtocolValue {
@Override
- public int getColumnLength(final Object value) {
+ public int getColumnLength(final PostgreSQLPacketPayload payload, final
Object value) {
return ((byte[]) value).length;
}
diff --git
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLDateBinaryProtocolValue.java
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLDateBinaryProtocolValue.java
index f911c4ee6aa..8556ab3981c 100644
---
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLDateBinaryProtocolValue.java
+++
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLDateBinaryProtocolValue.java
@@ -30,7 +30,7 @@ import java.sql.Date;
public final class PostgreSQLDateBinaryProtocolValue implements
PostgreSQLBinaryProtocolValue {
@Override
- public int getColumnLength(final Object value) {
+ public int getColumnLength(final PostgreSQLPacketPayload payload, final
Object value) {
return 4;
}
diff --git
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLDoubleBinaryProtocolValue.java
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLDoubleBinaryProtocolValue.java
index d947e9caab6..1e8dd565b62 100644
---
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLDoubleBinaryProtocolValue.java
+++
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLDoubleBinaryProtocolValue.java
@@ -25,7 +25,7 @@ import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacket
public final class PostgreSQLDoubleBinaryProtocolValue implements
PostgreSQLBinaryProtocolValue {
@Override
- public int getColumnLength(final Object value) {
+ public int getColumnLength(final PostgreSQLPacketPayload payload, final
Object value) {
return 8;
}
diff --git
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloat4ArrayBinaryProtocolValue.java
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloat4ArrayBinaryProtocolValue.java
index 76e257c670e..2ce2b3d7e09 100644
---
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloat4ArrayBinaryProtocolValue.java
+++
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloat4ArrayBinaryProtocolValue.java
@@ -28,7 +28,7 @@ public final class PostgreSQLFloat4ArrayBinaryProtocolValue
implements PostgreSQ
private static final PostgreSQLArrayParameterDecoder
ARRAY_PARAMETER_DECODER = new PostgreSQLArrayParameterDecoder();
@Override
- public int getColumnLength(final Object value) {
+ public int getColumnLength(final PostgreSQLPacketPayload payload, final
Object value) {
throw new
UnsupportedSQLOperationException("PostgreSQLFloat4ArrayBinaryProtocolValue.getColumnLength()");
}
diff --git
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloat8ArrayBinaryProtocolValue.java
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloat8ArrayBinaryProtocolValue.java
index 346b028b35d..33c0bd8b9b4 100644
---
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloat8ArrayBinaryProtocolValue.java
+++
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloat8ArrayBinaryProtocolValue.java
@@ -28,7 +28,7 @@ public final class PostgreSQLFloat8ArrayBinaryProtocolValue
implements PostgreSQ
private static final PostgreSQLArrayParameterDecoder
ARRAY_PARAMETER_DECODER = new PostgreSQLArrayParameterDecoder();
@Override
- public int getColumnLength(final Object value) {
+ public int getColumnLength(final PostgreSQLPacketPayload payload, final
Object value) {
throw new
UnsupportedSQLOperationException("PostgreSQLFloat8ArrayBinaryProtocolValue.getColumnLength()");
}
diff --git
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloatBinaryProtocolValue.java
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloatBinaryProtocolValue.java
index 9d29da58374..e3a1d12cf37 100644
---
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloatBinaryProtocolValue.java
+++
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloatBinaryProtocolValue.java
@@ -25,7 +25,7 @@ import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacket
public final class PostgreSQLFloatBinaryProtocolValue implements
PostgreSQLBinaryProtocolValue {
@Override
- public int getColumnLength(final Object value) {
+ public int getColumnLength(final PostgreSQLPacketPayload payload, final
Object value) {
return 4;
}
diff --git
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt2ArrayBinaryProtocolValue.java
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt2ArrayBinaryProtocolValue.java
index 01a811f34a2..12b89103938 100644
---
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt2ArrayBinaryProtocolValue.java
+++
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt2ArrayBinaryProtocolValue.java
@@ -28,7 +28,7 @@ public final class PostgreSQLInt2ArrayBinaryProtocolValue
implements PostgreSQLB
private static final PostgreSQLArrayParameterDecoder
ARRAY_PARAMETER_DECODER = new PostgreSQLArrayParameterDecoder();
@Override
- public int getColumnLength(final Object value) {
+ public int getColumnLength(final PostgreSQLPacketPayload payload, final
Object value) {
throw new
UnsupportedSQLOperationException("PostgreSQLInt2ArrayBinaryProtocolValue.getColumnLength()");
}
diff --git
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt2BinaryProtocolValue.java
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt2BinaryProtocolValue.java
index 94562b52822..e8837524e42 100644
---
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt2BinaryProtocolValue.java
+++
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt2BinaryProtocolValue.java
@@ -25,7 +25,7 @@ import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacket
public final class PostgreSQLInt2BinaryProtocolValue implements
PostgreSQLBinaryProtocolValue {
@Override
- public int getColumnLength(final Object value) {
+ public int getColumnLength(final PostgreSQLPacketPayload payload, final
Object value) {
return 2;
}
diff --git
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt4ArrayBinaryProtocolValue.java
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt4ArrayBinaryProtocolValue.java
index 31c0bdbab38..027c86d4af5 100644
---
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt4ArrayBinaryProtocolValue.java
+++
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt4ArrayBinaryProtocolValue.java
@@ -28,7 +28,7 @@ public final class PostgreSQLInt4ArrayBinaryProtocolValue
implements PostgreSQLB
private static final PostgreSQLArrayParameterDecoder
ARRAY_PARAMETER_DECODER = new PostgreSQLArrayParameterDecoder();
@Override
- public int getColumnLength(final Object value) {
+ public int getColumnLength(final PostgreSQLPacketPayload payload, final
Object value) {
throw new
UnsupportedSQLOperationException("PostgreSQLInt4ArrayBinaryProtocolValue.getColumnLength()");
}
diff --git
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt4BinaryProtocolValue.java
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt4BinaryProtocolValue.java
index 18c61c5f84c..38a1fe412dd 100644
---
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt4BinaryProtocolValue.java
+++
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt4BinaryProtocolValue.java
@@ -25,7 +25,7 @@ import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacket
public final class PostgreSQLInt4BinaryProtocolValue implements
PostgreSQLBinaryProtocolValue {
@Override
- public int getColumnLength(final Object value) {
+ public int getColumnLength(final PostgreSQLPacketPayload payload, final
Object value) {
return 4;
}
diff --git
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt8ArrayBinaryProtocolValue.java
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt8ArrayBinaryProtocolValue.java
index f7ee9060b43..96e01e8448f 100644
---
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt8ArrayBinaryProtocolValue.java
+++
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt8ArrayBinaryProtocolValue.java
@@ -28,7 +28,7 @@ public final class PostgreSQLInt8ArrayBinaryProtocolValue
implements PostgreSQLB
private static final PostgreSQLArrayParameterDecoder
ARRAY_PARAMETER_DECODER = new PostgreSQLArrayParameterDecoder();
@Override
- public int getColumnLength(final Object value) {
+ public int getColumnLength(final PostgreSQLPacketPayload payload, final
Object value) {
throw new
UnsupportedSQLOperationException("PostgreSQLInt8ArrayBinaryProtocolValue.getColumnLength()");
}
diff --git
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt8BinaryProtocolValue.java
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt8BinaryProtocolValue.java
index c11cccc34f9..a5501d10c07 100644
---
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt8BinaryProtocolValue.java
+++
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt8BinaryProtocolValue.java
@@ -25,7 +25,7 @@ import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacket
public final class PostgreSQLInt8BinaryProtocolValue implements
PostgreSQLBinaryProtocolValue {
@Override
- public int getColumnLength(final Object value) {
+ public int getColumnLength(final PostgreSQLPacketPayload payload, final
Object value) {
return 8;
}
diff --git
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLNumericBinaryProtocolValue.java
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLNumericBinaryProtocolValue.java
index 32559f8bae3..3c50868077b 100644
---
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLNumericBinaryProtocolValue.java
+++
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLNumericBinaryProtocolValue.java
@@ -29,7 +29,7 @@ import java.nio.charset.StandardCharsets;
public final class PostgreSQLNumericBinaryProtocolValue implements
PostgreSQLBinaryProtocolValue {
@Override
- public int getColumnLength(final Object value) {
+ public int getColumnLength(final PostgreSQLPacketPayload payload, final
Object value) {
return value instanceof BigDecimal ?
ByteConverter.numeric((BigDecimal) value).length :
value.toString().getBytes(StandardCharsets.UTF_8).length;
}
diff --git
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLStringArrayBinaryProtocolValue.java
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLStringArrayBinaryProtocolValue.java
index 95794304fc5..b84652a1b42 100644
---
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLStringArrayBinaryProtocolValue.java
+++
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLStringArrayBinaryProtocolValue.java
@@ -28,7 +28,7 @@ public final class PostgreSQLStringArrayBinaryProtocolValue
implements PostgreSQ
private static final PostgreSQLArrayParameterDecoder
ARRAY_PARAMETER_DECODER = new PostgreSQLArrayParameterDecoder();
@Override
- public int getColumnLength(final Object value) {
+ public int getColumnLength(final PostgreSQLPacketPayload payload, final
Object value) {
throw new
UnsupportedSQLOperationException("PostgreSQLStringArrayBinaryProtocolValue.getColumnLength()");
}
diff --git
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLStringBinaryProtocolValue.java
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLStringBinaryProtocolValue.java
index 9aeadee8538..8df80783c93 100644
---
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLStringBinaryProtocolValue.java
+++
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLStringBinaryProtocolValue.java
@@ -25,8 +25,11 @@ import
org.apache.shardingsphere.db.protocol.postgresql.payload.PostgreSQLPacket
public final class PostgreSQLStringBinaryProtocolValue implements
PostgreSQLBinaryProtocolValue {
@Override
- public int getColumnLength(final Object value) {
- return value.toString().length();
+ public int getColumnLength(final PostgreSQLPacketPayload payload, final
Object value) {
+ if (value instanceof byte[]) {
+ return ((byte[]) value).length;
+ }
+ return value.toString().getBytes(payload.getCharset()).length;
}
@Override
diff --git
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLTextArrayBinaryProtocolValue.java
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLTextArrayBinaryProtocolValue.java
index 1a92c3e1924..dcba93874de 100644
---
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLTextArrayBinaryProtocolValue.java
+++
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLTextArrayBinaryProtocolValue.java
@@ -40,7 +40,7 @@ public final class PostgreSQLTextArrayBinaryProtocolValue
implements PostgreSQLB
private static final int ARRAY_HEADER_LENGTH = 20;
@Override
- public int getColumnLength(final Object value) {
+ public int getColumnLength(final PostgreSQLPacketPayload payload, final
Object value) {
throw new
UnsupportedSQLOperationException("PostgreSQLTextArrayBinaryProtocolValue.getColumnLength()");
}
diff --git
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLTimeBinaryProtocolValue.java
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLTimeBinaryProtocolValue.java
index e26b4eb0697..7bad52de644 100644
---
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLTimeBinaryProtocolValue.java
+++
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLTimeBinaryProtocolValue.java
@@ -28,7 +28,7 @@ import java.sql.Timestamp;
public final class PostgreSQLTimeBinaryProtocolValue implements
PostgreSQLBinaryProtocolValue {
@Override
- public int getColumnLength(final Object value) {
+ public int getColumnLength(final PostgreSQLPacketPayload payload, final
Object value) {
return 8;
}
diff --git
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLUUIDBinaryProtocolValue.java
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLUUIDBinaryProtocolValue.java
index 1b51961e4c7..da029529288 100644
---
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLUUIDBinaryProtocolValue.java
+++
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLUUIDBinaryProtocolValue.java
@@ -28,7 +28,7 @@ import java.util.UUID;
public final class PostgreSQLUUIDBinaryProtocolValue implements
PostgreSQLBinaryProtocolValue {
@Override
- public int getColumnLength(final Object value) {
+ public int getColumnLength(final PostgreSQLPacketPayload payload, final
Object value) {
return 16;
}
diff --git
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLUnspecifiedBinaryProtocolValue.java
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLUnspecifiedBinaryProtocolValue.java
index b0820104889..b2520eb3398 100644
---
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLUnspecifiedBinaryProtocolValue.java
+++
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLUnspecifiedBinaryProtocolValue.java
@@ -27,7 +27,7 @@ import
org.apache.shardingsphere.infra.exception.generic.UnsupportedSQLOperation
public final class PostgreSQLUnspecifiedBinaryProtocolValue implements
PostgreSQLBinaryProtocolValue {
@Override
- public int getColumnLength(final Object value) {
+ public int getColumnLength(final PostgreSQLPacketPayload payload, final
Object value) {
throw new UnsupportedSQLOperationException("getColumnLength");
}
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBoolArrayBinaryProtocolValueTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBoolArrayBinaryProtocolValueTest.java
index b3a723d2b85..8e7c5995fe2 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBoolArrayBinaryProtocolValueTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBoolArrayBinaryProtocolValueTest.java
@@ -31,13 +31,9 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
class PostgreSQLBoolArrayBinaryProtocolValueTest {
- private PostgreSQLBinaryProtocolValue newInstance() {
- return new PostgreSQLBoolArrayBinaryProtocolValue();
- }
-
@Test
void assertGetColumnLength() {
- assertThrows(UnsupportedSQLOperationException.class, () ->
newInstance().getColumnLength("val"));
+ assertThrows(UnsupportedSQLOperationException.class, () -> new
PostgreSQLBoolArrayBinaryProtocolValue().getColumnLength(new
PostgreSQLPacketPayload(null, StandardCharsets.UTF_8), "val"));
}
@Test
@@ -49,13 +45,13 @@ class PostgreSQLBoolArrayBinaryProtocolValueTest {
byteBuf.writeCharSequence(parameterValue, StandardCharsets.ISO_8859_1);
byteBuf.readInt();
PostgreSQLPacketPayload payload = new PostgreSQLPacketPayload(byteBuf,
StandardCharsets.UTF_8);
- Object actual = newInstance().read(payload, parameterValue.length());
+ Object actual = new
PostgreSQLBoolArrayBinaryProtocolValue().read(payload, parameterValue.length());
assertThat(actual, is(new boolean[]{true, false}));
assertThat(byteBuf.readerIndex(), is(expectedLength));
}
@Test
void assertWrite() {
- assertThrows(UnsupportedSQLOperationException.class, () ->
newInstance().write(new PostgreSQLPacketPayload(null, StandardCharsets.UTF_8),
"val"));
+ assertThrows(UnsupportedSQLOperationException.class, () -> new
PostgreSQLBoolArrayBinaryProtocolValue().write(new
PostgreSQLPacketPayload(null, StandardCharsets.UTF_8), "val"));
}
}
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBoolBinaryProtocolValueTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBoolBinaryProtocolValueTest.java
index 6930010dc59..453e1c76a12 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBoolBinaryProtocolValueTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBoolBinaryProtocolValueTest.java
@@ -42,7 +42,7 @@ class PostgreSQLBoolBinaryProtocolValueTest {
@Test
void assertNewInstance() {
PostgreSQLBoolBinaryProtocolValue actual = new
PostgreSQLBoolBinaryProtocolValue();
- assertThat(actual.getColumnLength(null), is(1));
+ assertThat(actual.getColumnLength(payload, null), is(1));
when(payload.getByteBuf()).thenReturn(byteBuf);
when(byteBuf.readBoolean()).thenReturn(true);
assertTrue((boolean) actual.read(payload, 1));
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLByteaBinaryProtocolValueTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLByteaBinaryProtocolValueTest.java
index a6eca9939ff..35185d06a5c 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLByteaBinaryProtocolValueTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLByteaBinaryProtocolValueTest.java
@@ -31,7 +31,7 @@ class PostgreSQLByteaBinaryProtocolValueTest {
@Test
void assertGetColumnLength() {
- assertThat(new
PostgreSQLByteaBinaryProtocolValue().getColumnLength(new byte[10]), is(10));
+ assertThat(new
PostgreSQLByteaBinaryProtocolValue().getColumnLength(new
PostgreSQLPacketPayload(null, StandardCharsets.UTF_8), new byte[10]), is(10));
}
@Test
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLDateBinaryProtocolValueTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLDateBinaryProtocolValueTest.java
index a4900cc7cd3..36a05f50c62 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLDateBinaryProtocolValueTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLDateBinaryProtocolValueTest.java
@@ -36,7 +36,7 @@ class PostgreSQLDateBinaryProtocolValueTest {
@Test
void assertGetColumnLength() {
- assertThat(new
PostgreSQLDateBinaryProtocolValue().getColumnLength(""), is(4));
+ assertThat(new PostgreSQLDateBinaryProtocolValue().getColumnLength(new
PostgreSQLPacketPayload(null, StandardCharsets.UTF_8), ""), is(4));
}
@Test
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLDoubleBinaryProtocolValueTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLDoubleBinaryProtocolValueTest.java
index 217652137ae..e5a51a57bca 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLDoubleBinaryProtocolValueTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLDoubleBinaryProtocolValueTest.java
@@ -39,7 +39,7 @@ class PostgreSQLDoubleBinaryProtocolValueTest {
@Test
void assertGetColumnLength() {
- assertThat(new
PostgreSQLDoubleBinaryProtocolValue().getColumnLength(""), is(8));
+ assertThat(new
PostgreSQLDoubleBinaryProtocolValue().getColumnLength(new
PostgreSQLPacketPayload(null, StandardCharsets.UTF_8), ""), is(8));
}
@Test
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloat4ArrayBinaryProtocolValueTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloat4ArrayBinaryProtocolValueTest.java
index 091afa5ebd5..c221f3f6860 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloat4ArrayBinaryProtocolValueTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloat4ArrayBinaryProtocolValueTest.java
@@ -31,13 +31,9 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
class PostgreSQLFloat4ArrayBinaryProtocolValueTest {
- private PostgreSQLBinaryProtocolValue newInstance() {
- return new PostgreSQLFloat4ArrayBinaryProtocolValue();
- }
-
@Test
void assertGetColumnLength() {
- assertThrows(UnsupportedSQLOperationException.class, () ->
newInstance().getColumnLength("val"));
+ assertThrows(UnsupportedSQLOperationException.class, () -> new
PostgreSQLFloat4ArrayBinaryProtocolValue().getColumnLength(new
PostgreSQLPacketPayload(null, StandardCharsets.UTF_8), "val"));
}
@Test
@@ -49,13 +45,13 @@ class PostgreSQLFloat4ArrayBinaryProtocolValueTest {
byteBuf.writeCharSequence(parameterValue, StandardCharsets.ISO_8859_1);
byteBuf.readInt();
PostgreSQLPacketPayload payload = new PostgreSQLPacketPayload(byteBuf,
StandardCharsets.UTF_8);
- Object actual = newInstance().read(payload, parameterValue.length());
+ Object actual = new
PostgreSQLFloat4ArrayBinaryProtocolValue().read(payload,
parameterValue.length());
assertThat(actual, is(new float[]{11.1F, 12.1F}));
assertThat(byteBuf.readerIndex(), is(expectedLength));
}
@Test
void assertWrite() {
- assertThrows(UnsupportedSQLOperationException.class, () ->
newInstance().write(new PostgreSQLPacketPayload(null, StandardCharsets.UTF_8),
"val"));
+ assertThrows(UnsupportedSQLOperationException.class, () -> new
PostgreSQLFloat4ArrayBinaryProtocolValue().write(new
PostgreSQLPacketPayload(null, StandardCharsets.UTF_8), "val"));
}
}
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloat8ArrayBinaryProtocolValueTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloat8ArrayBinaryProtocolValueTest.java
index f59dbc7b91c..d165ced307c 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloat8ArrayBinaryProtocolValueTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloat8ArrayBinaryProtocolValueTest.java
@@ -31,13 +31,9 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
class PostgreSQLFloat8ArrayBinaryProtocolValueTest {
- private PostgreSQLBinaryProtocolValue newInstance() {
- return new PostgreSQLFloat8ArrayBinaryProtocolValue();
- }
-
@Test
void assertGetColumnLength() {
- assertThrows(UnsupportedSQLOperationException.class, () ->
newInstance().getColumnLength("val"));
+ assertThrows(UnsupportedSQLOperationException.class, () -> new
PostgreSQLFloat8ArrayBinaryProtocolValue().getColumnLength(new
PostgreSQLPacketPayload(null, StandardCharsets.UTF_8), "val"));
}
@Test
@@ -49,13 +45,13 @@ class PostgreSQLFloat8ArrayBinaryProtocolValueTest {
byteBuf.writeCharSequence(parameterValue, StandardCharsets.ISO_8859_1);
byteBuf.readInt();
PostgreSQLPacketPayload payload = new PostgreSQLPacketPayload(byteBuf,
StandardCharsets.UTF_8);
- Object actual = newInstance().read(payload, parameterValue.length());
+ Object actual = new
PostgreSQLFloat8ArrayBinaryProtocolValue().read(payload,
parameterValue.length());
assertThat(actual, is(new double[]{11.1D, 12.1D}));
assertThat(byteBuf.readerIndex(), is(expectedLength));
}
@Test
void assertWrite() {
- assertThrows(UnsupportedSQLOperationException.class, () ->
newInstance().write(new PostgreSQLPacketPayload(null, StandardCharsets.UTF_8),
"val"));
+ assertThrows(UnsupportedSQLOperationException.class, () -> new
PostgreSQLFloat8ArrayBinaryProtocolValue().write(new
PostgreSQLPacketPayload(null, StandardCharsets.UTF_8), "val"));
}
}
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloatBinaryProtocolValueTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloatBinaryProtocolValueTest.java
index eb85485858d..a6146bdf6f1 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloatBinaryProtocolValueTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLFloatBinaryProtocolValueTest.java
@@ -39,7 +39,7 @@ class PostgreSQLFloatBinaryProtocolValueTest {
@Test
void assertGetColumnLength() {
- assertThat(new
PostgreSQLFloatBinaryProtocolValue().getColumnLength(""), is(4));
+ assertThat(new
PostgreSQLFloatBinaryProtocolValue().getColumnLength(new
PostgreSQLPacketPayload(null, StandardCharsets.UTF_8), ""), is(4));
}
@Test
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt2ArrayBinaryProtocolValueTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt2ArrayBinaryProtocolValueTest.java
index 63f545674b0..fd644a0e8d1 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt2ArrayBinaryProtocolValueTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt2ArrayBinaryProtocolValueTest.java
@@ -31,13 +31,9 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
class PostgreSQLInt2ArrayBinaryProtocolValueTest {
- private PostgreSQLBinaryProtocolValue newInstance() {
- return new PostgreSQLInt2ArrayBinaryProtocolValue();
- }
-
@Test
void assertGetColumnLength() {
- assertThrows(UnsupportedSQLOperationException.class, () ->
newInstance().getColumnLength("val"));
+ assertThrows(UnsupportedSQLOperationException.class, () -> new
PostgreSQLInt2ArrayBinaryProtocolValue().getColumnLength(new
PostgreSQLPacketPayload(null, StandardCharsets.UTF_8), "val"));
}
@Test
@@ -49,13 +45,13 @@ class PostgreSQLInt2ArrayBinaryProtocolValueTest {
byteBuf.writeCharSequence(parameterValue, StandardCharsets.ISO_8859_1);
byteBuf.readInt();
PostgreSQLPacketPayload payload = new PostgreSQLPacketPayload(byteBuf,
StandardCharsets.UTF_8);
- Object actual = newInstance().read(payload, parameterValue.length());
+ Object actual = new
PostgreSQLInt2ArrayBinaryProtocolValue().read(payload, parameterValue.length());
assertThat(actual, is(new short[]{11, 12}));
assertThat(byteBuf.readerIndex(), is(expectedLength));
}
@Test
void assertWrite() {
- assertThrows(UnsupportedSQLOperationException.class, () ->
newInstance().write(new PostgreSQLPacketPayload(null, StandardCharsets.UTF_8),
"val"));
+ assertThrows(UnsupportedSQLOperationException.class, () -> new
PostgreSQLInt2ArrayBinaryProtocolValue().write(new
PostgreSQLPacketPayload(null, StandardCharsets.UTF_8), "val"));
}
}
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt2BinaryProtocolValueTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt2BinaryProtocolValueTest.java
index 2d2da3201cc..e25f684930e 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt2BinaryProtocolValueTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt2BinaryProtocolValueTest.java
@@ -30,7 +30,7 @@ class PostgreSQLInt2BinaryProtocolValueTest {
@Test
void assertGetColumnLength() {
- assertThat(new
PostgreSQLInt2BinaryProtocolValue().getColumnLength(null), is(2));
+ assertThat(new PostgreSQLInt2BinaryProtocolValue().getColumnLength(new
PostgreSQLPacketPayload(null, StandardCharsets.UTF_8), null), is(2));
}
@Test
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt4ArrayBinaryProtocolValueTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt4ArrayBinaryProtocolValueTest.java
index 9f590cece93..e3545c7f6c5 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt4ArrayBinaryProtocolValueTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt4ArrayBinaryProtocolValueTest.java
@@ -31,13 +31,9 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
class PostgreSQLInt4ArrayBinaryProtocolValueTest {
- private PostgreSQLBinaryProtocolValue newInstance() {
- return new PostgreSQLInt4ArrayBinaryProtocolValue();
- }
-
@Test
void assertGetColumnLength() {
- assertThrows(UnsupportedSQLOperationException.class, () ->
newInstance().getColumnLength("val"));
+ assertThrows(UnsupportedSQLOperationException.class, () -> new
PostgreSQLInt4ArrayBinaryProtocolValue().getColumnLength(new
PostgreSQLPacketPayload(null, StandardCharsets.UTF_8), "val"));
}
@Test
@@ -49,13 +45,13 @@ class PostgreSQLInt4ArrayBinaryProtocolValueTest {
byteBuf.writeCharSequence(parameterValue, StandardCharsets.ISO_8859_1);
byteBuf.readInt();
PostgreSQLPacketPayload payload = new PostgreSQLPacketPayload(byteBuf,
StandardCharsets.UTF_8);
- Object actual = newInstance().read(payload, parameterValue.length());
+ Object actual = new
PostgreSQLInt4ArrayBinaryProtocolValue().read(payload, parameterValue.length());
assertThat(actual, is(new int[]{11, 12}));
assertThat(byteBuf.readerIndex(), is(expectedLength));
}
@Test
void assertWrite() {
- assertThrows(UnsupportedSQLOperationException.class, () ->
newInstance().write(new PostgreSQLPacketPayload(null, StandardCharsets.UTF_8),
"val"));
+ assertThrows(UnsupportedSQLOperationException.class, () -> new
PostgreSQLInt4ArrayBinaryProtocolValue().write(new
PostgreSQLPacketPayload(null, StandardCharsets.UTF_8), "val"));
}
}
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt4BinaryProtocolValueTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt4BinaryProtocolValueTest.java
index 2f549f8cafd..35fdbe152c1 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt4BinaryProtocolValueTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt4BinaryProtocolValueTest.java
@@ -37,7 +37,7 @@ class PostgreSQLInt4BinaryProtocolValueTest {
@Test
void assertNewInstance() {
PostgreSQLInt4BinaryProtocolValue actual = new
PostgreSQLInt4BinaryProtocolValue();
- assertThat(actual.getColumnLength(null), is(4));
+ assertThat(actual.getColumnLength(payload, null), is(4));
when(payload.readInt4()).thenReturn(1);
assertThat(actual.read(payload, 4), is(1));
actual.write(payload, 1);
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt8ArrayBinaryProtocolValueTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt8ArrayBinaryProtocolValueTest.java
index 699a07de419..d116e759bd6 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt8ArrayBinaryProtocolValueTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt8ArrayBinaryProtocolValueTest.java
@@ -31,13 +31,9 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
class PostgreSQLInt8ArrayBinaryProtocolValueTest {
- private PostgreSQLBinaryProtocolValue newInstance() {
- return new PostgreSQLInt8ArrayBinaryProtocolValue();
- }
-
@Test
void assertGetColumnLength() {
- assertThrows(UnsupportedSQLOperationException.class, () ->
newInstance().getColumnLength("val"));
+ assertThrows(UnsupportedSQLOperationException.class, () -> new
PostgreSQLInt8ArrayBinaryProtocolValue().getColumnLength(new
PostgreSQLPacketPayload(null, StandardCharsets.UTF_8), "val"));
}
@Test
@@ -49,13 +45,13 @@ class PostgreSQLInt8ArrayBinaryProtocolValueTest {
byteBuf.writeCharSequence(parameterValue, StandardCharsets.ISO_8859_1);
byteBuf.readInt();
PostgreSQLPacketPayload payload = new PostgreSQLPacketPayload(byteBuf,
StandardCharsets.UTF_8);
- Object actual = newInstance().read(payload, parameterValue.length());
+ Object actual = new
PostgreSQLInt8ArrayBinaryProtocolValue().read(payload, parameterValue.length());
assertThat(actual, is(new long[]{11L, 12L}));
assertThat(byteBuf.readerIndex(), is(expectedLength));
}
@Test
void assertWrite() {
- assertThrows(UnsupportedSQLOperationException.class, () ->
newInstance().write(new PostgreSQLPacketPayload(null, StandardCharsets.UTF_8),
"val"));
+ assertThrows(UnsupportedSQLOperationException.class, () -> new
PostgreSQLInt8ArrayBinaryProtocolValue().write(new
PostgreSQLPacketPayload(null, StandardCharsets.UTF_8), "val"));
}
}
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt8BinaryProtocolValueTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt8BinaryProtocolValueTest.java
index e244e4a157d..570dbe345a8 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt8BinaryProtocolValueTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt8BinaryProtocolValueTest.java
@@ -34,7 +34,7 @@ class PostgreSQLInt8BinaryProtocolValueTest {
@Test
void assertGetColumnLength() {
- assertThat(new
PostgreSQLInt8BinaryProtocolValue().getColumnLength(1L), is(8));
+ assertThat(new PostgreSQLInt8BinaryProtocolValue().getColumnLength(new
PostgreSQLPacketPayload(null, StandardCharsets.UTF_8), 1L), is(8));
}
@Test
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLNumericBinaryProtocolValueTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLNumericBinaryProtocolValueTest.java
index f3dc059494e..3cc04594857 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLNumericBinaryProtocolValueTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLNumericBinaryProtocolValueTest.java
@@ -39,7 +39,7 @@ class PostgreSQLNumericBinaryProtocolValueTest {
@ArgumentsSource(TestCaseArgumentsProvider.class)
void assertGetColumnLength(final BigDecimal bigDecimal, final byte[]
expected) {
PostgreSQLNumericBinaryProtocolValue binaryProtocolValue = new
PostgreSQLNumericBinaryProtocolValue();
- assertThat(binaryProtocolValue.getColumnLength(bigDecimal),
is(expected.length));
+ assertThat(binaryProtocolValue.getColumnLength(new
PostgreSQLPacketPayload(null, StandardCharsets.UTF_8), bigDecimal),
is(expected.length));
}
@ParameterizedTest(name = "{0}")
@@ -59,7 +59,7 @@ class PostgreSQLNumericBinaryProtocolValueTest {
@ArgumentsSource(TestCaseArgumentsProvider.class)
void assertWrite(final BigDecimal bigDecimal, final byte[] expected) {
PostgreSQLNumericBinaryProtocolValue binaryProtocolValue = new
PostgreSQLNumericBinaryProtocolValue();
- int columnLength = binaryProtocolValue.getColumnLength(bigDecimal);
+ int columnLength = binaryProtocolValue.getColumnLength(new
PostgreSQLPacketPayload(null, StandardCharsets.UTF_8), bigDecimal);
ByteBuf byteBuf = ByteBufTestUtils.createByteBuf(columnLength);
PostgreSQLPacketPayload payload = new PostgreSQLPacketPayload(byteBuf,
StandardCharsets.UTF_8);
binaryProtocolValue.write(payload, bigDecimal);
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLStringArrayBinaryProtocolValueTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLStringArrayBinaryProtocolValueTest.java
index 5eb86e886e8..c677042f343 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLStringArrayBinaryProtocolValueTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLStringArrayBinaryProtocolValueTest.java
@@ -31,13 +31,9 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
class PostgreSQLStringArrayBinaryProtocolValueTest {
- private PostgreSQLBinaryProtocolValue newInstance() {
- return new PostgreSQLStringArrayBinaryProtocolValue();
- }
-
@Test
void assertGetColumnLength() {
- assertThrows(UnsupportedSQLOperationException.class, () ->
newInstance().getColumnLength("val"));
+ assertThrows(UnsupportedSQLOperationException.class, () -> new
PostgreSQLStringArrayBinaryProtocolValue().getColumnLength(new
PostgreSQLPacketPayload(null, StandardCharsets.UTF_8), "val"));
}
@Test
@@ -49,13 +45,13 @@ class PostgreSQLStringArrayBinaryProtocolValueTest {
byteBuf.writeCharSequence(parameterValue, StandardCharsets.ISO_8859_1);
byteBuf.readInt();
PostgreSQLPacketPayload payload = new PostgreSQLPacketPayload(byteBuf,
StandardCharsets.UTF_8);
- Object actual = newInstance().read(payload, parameterValue.length());
+ Object actual = new
PostgreSQLStringArrayBinaryProtocolValue().read(payload,
parameterValue.length());
assertThat(actual, is(new String[]{"a", "b"}));
assertThat(byteBuf.readerIndex(), is(expectedLength));
}
@Test
void assertWrite() {
- assertThrows(UnsupportedSQLOperationException.class, () ->
newInstance().write(new PostgreSQLPacketPayload(null, StandardCharsets.UTF_8),
"val"));
+ assertThrows(UnsupportedSQLOperationException.class, () -> new
PostgreSQLStringArrayBinaryProtocolValue().write(new
PostgreSQLPacketPayload(null, StandardCharsets.UTF_8), "val"));
}
}
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLStringBinaryProtocolValueTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLStringBinaryProtocolValueTest.java
index a8768573326..0a90af93f50 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLStringBinaryProtocolValueTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLStringBinaryProtocolValueTest.java
@@ -48,16 +48,28 @@ class PostgreSQLStringBinaryProtocolValueTest {
}
@Test
- void assertNewInstance() {
+ void assertGetColumnLength() {
+ PostgreSQLStringBinaryProtocolValue actual = new
PostgreSQLStringBinaryProtocolValue();
+ assertThat(actual.getColumnLength(payload, "English"), is(7));
+ assertThat(actual.getColumnLength(payload, "中文"), is(6));
+ assertThat(actual.getColumnLength(payload, new byte[]{1, 2, 3}),
is(3));
+ }
+
+ @Test
+ void assertRead() {
doAnswer((Answer<ByteBuf>) invocation -> {
((byte[]) invocation.getArguments()[0])[0] = 'a';
return byteBuf;
}).when(byteBuf).readBytes(any(byte[].class));
PostgreSQLStringBinaryProtocolValue actual = new
PostgreSQLStringBinaryProtocolValue();
- assertThat(actual.getColumnLength("str"), is("str".length()));
assertThat(actual.read(payload, "a".length()), is("a"));
- actual.write(payload, "a");
- verify(byteBuf).writeBytes("a".getBytes(StandardCharsets.UTF_8));
+ }
+
+ @Test
+ void assertWrite() {
+ PostgreSQLStringBinaryProtocolValue actual = new
PostgreSQLStringBinaryProtocolValue();
+ actual.write(payload, "foo");
+ verify(byteBuf).writeBytes("foo".getBytes(StandardCharsets.UTF_8));
actual.write(payload, new byte[1]);
verify(byteBuf).writeBytes(new byte[1]);
}
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLTimeBinaryProtocolValueTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLTimeBinaryProtocolValueTest.java
index 26b58b94f10..4bfaa18d62f 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLTimeBinaryProtocolValueTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLTimeBinaryProtocolValueTest.java
@@ -40,7 +40,7 @@ class PostgreSQLTimeBinaryProtocolValueTest {
@Test
void assertNewInstance() {
PostgreSQLTimeBinaryProtocolValue actual = new
PostgreSQLTimeBinaryProtocolValue();
- assertThat(actual.getColumnLength(null), is(8));
+ assertThat(actual.getColumnLength(payload, null), is(8));
when(payload.readInt8()).thenReturn(1L);
assertThat(actual.read(payload, 8), is(1L));
Timestamp timestamp = new Timestamp(System.currentTimeMillis());
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLUUIDBinaryProtocolValueTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLUUIDBinaryProtocolValueTest.java
index 5955a26c48b..96bc08290f6 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLUUIDBinaryProtocolValueTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLUUIDBinaryProtocolValueTest.java
@@ -33,7 +33,7 @@ class PostgreSQLUUIDBinaryProtocolValueTest {
@Test
void assertGetColumnLength() {
- assertThat(new
PostgreSQLUUIDBinaryProtocolValue().getColumnLength(UUID.fromString("00000000-000-0000-0000-000000000001")),
is(16));
+ assertThat(new PostgreSQLUUIDBinaryProtocolValue().getColumnLength(new
PostgreSQLPacketPayload(null, StandardCharsets.UTF_8),
UUID.fromString("00000000-000-0000-0000-000000000001")), is(16));
}
@Test
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLUnspecifiedBinaryProtocolValueTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLUnspecifiedBinaryProtocolValueTest.java
index 001ec2e314e..ddc0c15976b 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLUnspecifiedBinaryProtocolValueTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLUnspecifiedBinaryProtocolValueTest.java
@@ -36,7 +36,7 @@ class PostgreSQLUnspecifiedBinaryProtocolValueTest {
@Test
void assertGetColumnLength() {
- assertThrows(UnsupportedSQLOperationException.class, () -> new
PostgreSQLUnspecifiedBinaryProtocolValue().getColumnLength("val"));
+ assertThrows(UnsupportedSQLOperationException.class, () -> new
PostgreSQLUnspecifiedBinaryProtocolValue().getColumnLength(new
PostgreSQLPacketPayload(null, StandardCharsets.UTF_8), "val"));
}
@Test