Browse Source

Polish JdbcTemplate to use getter instead of field

1. align with others in the same source file
2. allow subclass to override

Closes: gh-34501
Signed-off-by: Yanming Zhou <zhouyanming@gmail.com>
pull/34511/head
Yanming Zhou 10 months ago committed by Brian Clozel
parent
commit
7f020118eb
  1. 8
      spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcTemplate.java

8
spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcTemplate.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2024 the original author or authors. * Copyright 2002-2025 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.
@ -1234,7 +1234,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations {
int rsIndex = 0; int rsIndex = 0;
int updateIndex = 0; int updateIndex = 0;
boolean moreResults; boolean moreResults;
if (!this.skipResultsProcessing) { if (!isSkipResultsProcessing()) {
do { do {
if (updateCount == -1) { if (updateCount == -1) {
if (resultSetParameters != null && resultSetParameters.size() > rsIndex) { if (resultSetParameters != null && resultSetParameters.size() > rsIndex) {
@ -1243,7 +1243,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations {
rsIndex++; rsIndex++;
} }
else { else {
if (!this.skipUndeclaredResults) { if (!isSkipUndeclaredResults()) {
String rsName = RETURN_RESULT_SET_PREFIX + (rsIndex + 1); String rsName = RETURN_RESULT_SET_PREFIX + (rsIndex + 1);
SqlReturnResultSet undeclaredRsParam = new SqlReturnResultSet(rsName, getColumnMapRowMapper()); SqlReturnResultSet undeclaredRsParam = new SqlReturnResultSet(rsName, getColumnMapRowMapper());
if (logger.isTraceEnabled()) { if (logger.isTraceEnabled()) {
@ -1262,7 +1262,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations {
updateIndex++; updateIndex++;
} }
else { else {
if (!this.skipUndeclaredResults) { if (!isSkipUndeclaredResults()) {
String undeclaredName = RETURN_UPDATE_COUNT_PREFIX + (updateIndex + 1); String undeclaredName = RETURN_UPDATE_COUNT_PREFIX + (updateIndex + 1);
if (logger.isTraceEnabled()) { if (logger.isTraceEnabled()) {
logger.trace("Added default SqlReturnUpdateCount parameter named '" + undeclaredName + "'"); logger.trace("Added default SqlReturnUpdateCount parameter named '" + undeclaredName + "'");

Loading…
Cancel
Save