From ed693c1117fab58b2b2204a019f5103c36ef965d Mon Sep 17 00:00:00 2001 From: raojf Date: Thu, 9 Jan 2025 14:07:54 +0800 Subject: [PATCH 1/3] =?UTF-8?q?Fix=20issue#34287:Add=20judgment=20logic?= =?UTF-8?q?=EF=BC=8Cdetermine=20whether=20the=20number=20of=20parameters?= =?UTF-8?q?=20is=20greater=20than=20the=20number=20of=20inserted=20fields?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../query/binary/prepare/MySQLComStmtPrepareExecutor.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/prepare/MySQLComStmtPrepareExecutor.java b/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/prepare/MySQLComStmtPrepareExecutor.java index 9a28b33a684ea..53ddd7e1ca009 100644 --- a/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/prepare/MySQLComStmtPrepareExecutor.java +++ b/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/prepare/MySQLComStmtPrepareExecutor.java @@ -133,7 +133,11 @@ private Collection createParameterColumnDefinition41Packets(final S Collection result = new ArrayList<>(parameterMarkerSegments.size()); Collection paramColumnDefinitionFlags = new ArrayList<>(parameterMarkerSegments.size()); for (int index = 0; index < parameterMarkerSegments.size(); index++) { - ShardingSphereColumn column = columnsOfParameterMarkers.isEmpty() ? null : columnsOfParameterMarkers.get(index); + ShardingSphereColumn column = null; + // Determine whether the number of parameters is greater than the number of inserted fields + if (!columnsOfParameterMarkers.isEmpty() && index < columnsOfParameterMarkers.size()) { + column = columnsOfParameterMarkers.get(index); + } if (null != column) { int columnDefinitionFlag = calculateColumnDefinitionFlag(column); result.add(createMySQLColumnDefinition41Packet(characterSet, columnDefinitionFlag, MySQLBinaryColumnType.valueOfJDBCType(column.getDataType()))); From 3429bc71f70cda5a0c3aac0aa50642d8add7f25e Mon Sep 17 00:00:00 2001 From: raojf Date: Mon, 13 Jan 2025 11:44:49 +0800 Subject: [PATCH 2/3] Fix issue#34289:Add field type judgment --- .../context/segment/select/pagination/PaginationContext.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/context/segment/select/pagination/PaginationContext.java b/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/context/segment/select/pagination/PaginationContext.java index 69876d3c8cf10..6acda0c7fb195 100644 --- a/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/context/segment/select/pagination/PaginationContext.java +++ b/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/context/segment/select/pagination/PaginationContext.java @@ -58,7 +58,7 @@ private Long getValue(final PaginationValueSegment paginationValueSegment, final if (null == obj) { return null; } - return obj instanceof Long ? (long) obj : (int) obj; + return obj instanceof byte[] ? (long) (((byte[]) obj)[0] - '0') : obj instanceof Long ? (long) obj : (int) obj; } if (paginationValueSegment instanceof ExpressionRowNumberValueSegment) { return ((ExpressionRowNumberValueSegment) paginationValueSegment).getValue(params); From 6ab3c78135c904658b424ac9d8a9f6b73aba611f Mon Sep 17 00:00:00 2001 From: raojf Date: Tue, 14 Jan 2025 15:38:05 +0800 Subject: [PATCH 3/3] Add E2E SQL case --- .../e2e/sql/src/test/resources/cases/dql/e2e-dql-select.xml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/e2e/sql/src/test/resources/cases/dql/e2e-dql-select.xml b/test/e2e/sql/src/test/resources/cases/dql/e2e-dql-select.xml index e25146bbf08cb..b1f793b2f9af1 100644 --- a/test/e2e/sql/src/test/resources/cases/dql/e2e-dql-select.xml +++ b/test/e2e/sql/src/test/resources/cases/dql/e2e-dql-select.xml @@ -163,7 +163,7 @@ - + @@ -182,4 +182,8 @@ + + + +