Unwrap SqlParameterValue for disposable value detection in cleanupParameters
Closes gh-22972
This commit is contained in:
parent
30bc5e09e7
commit
43e315f10c
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2018 the original author or authors.
|
* Copyright 2002-2020 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -312,7 +312,6 @@ public abstract class StatementCreatorUtils {
|
||||||
else {
|
else {
|
||||||
ps.setClob(paramIndex, new StringReader(strVal), strVal.length());
|
ps.setClob(paramIndex, new StringReader(strVal), strVal.length());
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Fallback: setString or setNString binding
|
// Fallback: setString or setNString binding
|
||||||
|
@ -460,12 +459,17 @@ public abstract class StatementCreatorUtils {
|
||||||
public static void cleanupParameters(@Nullable Collection<?> paramValues) {
|
public static void cleanupParameters(@Nullable Collection<?> paramValues) {
|
||||||
if (paramValues != null) {
|
if (paramValues != null) {
|
||||||
for (Object inValue : paramValues) {
|
for (Object inValue : paramValues) {
|
||||||
if (inValue instanceof DisposableSqlTypeValue) {
|
// Unwrap SqlParameterValue first...
|
||||||
((DisposableSqlTypeValue) inValue).cleanup();
|
if (inValue instanceof SqlParameterValue) {
|
||||||
|
inValue = ((SqlParameterValue) inValue).getValue();
|
||||||
}
|
}
|
||||||
else if (inValue instanceof SqlValue) {
|
// Check for disposable value types
|
||||||
|
if (inValue instanceof SqlValue) {
|
||||||
((SqlValue) inValue).cleanup();
|
((SqlValue) inValue).cleanup();
|
||||||
}
|
}
|
||||||
|
else if (inValue instanceof DisposableSqlTypeValue) {
|
||||||
|
((DisposableSqlTypeValue) inValue).cleanup();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue