|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2018 the original author or authors. |
| 2 | + * Copyright 2002-2020 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
@@ -312,7 +312,6 @@ else if ((sqlType == Types.CLOB || sqlType == Types.NCLOB) && isStringValue(inVa
|
312 | 312 | else {
|
313 | 313 | ps.setClob(paramIndex, new StringReader(strVal), strVal.length());
|
314 | 314 | }
|
315 |
| - return; |
316 | 315 | }
|
317 | 316 | else {
|
318 | 317 | // Fallback: setString or setNString binding
|
@@ -460,12 +459,17 @@ public static void cleanupParameters(@Nullable Object... paramValues) {
|
460 | 459 | public static void cleanupParameters(@Nullable Collection<?> paramValues) {
|
461 | 460 | if (paramValues != null) {
|
462 | 461 | for (Object inValue : paramValues) {
|
463 |
| - if (inValue instanceof DisposableSqlTypeValue) { |
464 |
| - ((DisposableSqlTypeValue) inValue).cleanup(); |
| 462 | + // Unwrap SqlParameterValue first... |
| 463 | + if (inValue instanceof SqlParameterValue) { |
| 464 | + inValue = ((SqlParameterValue) inValue).getValue(); |
465 | 465 | }
|
466 |
| - else if (inValue instanceof SqlValue) { |
| 466 | + // Check for disposable value types |
| 467 | + if (inValue instanceof SqlValue) { |
467 | 468 | ((SqlValue) inValue).cleanup();
|
468 | 469 | }
|
| 470 | + else if (inValue instanceof DisposableSqlTypeValue) { |
| 471 | + ((DisposableSqlTypeValue) inValue).cleanup(); |
| 472 | + } |
469 | 473 | }
|
470 | 474 | }
|
471 | 475 | }
|
|
0 commit comments