This is an automated email from the ASF dual-hosted git repository.
zhangliang 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 8fc4146b5fc Fix issue#34287:Add judgment logic,determine whether the
number of parameters is greater than the number of inserted fields (#34291)
8fc4146b5fc is described below
commit 8fc4146b5fc0c44986c392313ab44eff185838d1
Author: raojf <[email protected]>
AuthorDate: Fri Jan 10 19:00:54 2025 +0800
Fix issue#34287:Add judgment logic,determine whether the number of
parameters is greater than the number of inserted fields (#34291)
Co-authored-by: raojf <[email protected]>
---
.../command/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 9a28b33a684..53ddd7e1ca0 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 @@ public final class MySQLComStmtPrepareExecutor implements
CommandExecutor {
Collection<MySQLPacket> result = new
ArrayList<>(parameterMarkerSegments.size());
Collection<Integer> 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())));