Skip to content

Commit bc283ed

Browse files
committed
Polishing
1 parent f31f654 commit bc283ed

File tree

2 files changed

+45
-44
lines changed

2 files changed

+45
-44
lines changed

spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcOperations.java

Lines changed: 37 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -166,14 +166,14 @@ public interface JdbcOperations {
166166
<T> T queryForObject(String sql, Class<T> requiredType) throws DataAccessException;
167167

168168
/**
169-
* Execute a query for a result Map, given static SQL.
169+
* Execute a query for a result map, given static SQL.
170170
* <p>Uses a JDBC Statement, not a PreparedStatement. If you want to
171171
* execute a static query with a PreparedStatement, use the overloaded
172172
* {@link #queryForMap(String, Object...)} method with {@code null}
173173
* as argument array.
174174
* <p>The query is expected to be a single row query; the result row will be
175175
* mapped to a Map (one entry for each column, using the column name as the key).
176-
* @param sql SQL query to execute
176+
* @param sql the SQL query to execute
177177
* @return the result Map (one entry per column, with column name as key)
178178
* @throws IncorrectResultSizeDataAccessException if the query does not
179179
* return exactly one row
@@ -208,7 +208,7 @@ public interface JdbcOperations {
208208
* <p>The results will be mapped to a List (one entry for each row) of
209209
* Maps (one entry for each column using the column name as the key).
210210
* Each element in the list will be of the form returned by this interface's
211-
* queryForMap() methods.
211+
* {@code queryForMap} methods.
212212
* @param sql the SQL query to execute
213213
* @return an List that contains a Map per row
214214
* @throws DataAccessException if there is any problem executing the query
@@ -558,8 +558,8 @@ <T> T queryForObject(String sql, Object[] args, int[] argTypes, RowMapper<T> row
558558
<T> T queryForObject(String sql, RowMapper<T> rowMapper, Object... args) throws DataAccessException;
559559

560560
/**
561-
* Query given SQL to create a prepared statement from SQL and a
562-
* list of arguments to bind to the query, expecting a result object.
561+
* Query given SQL to create a prepared statement from SQL and a list of
562+
* arguments to bind to the query, expecting a result object.
563563
* <p>The query is expected to be a single row/single column query; the returned
564564
* result will be directly mapped to the corresponding object type.
565565
* @param sql the SQL query to execute
@@ -578,8 +578,8 @@ <T> T queryForObject(String sql, Object[] args, int[] argTypes, Class<T> require
578578
throws DataAccessException;
579579

580580
/**
581-
* Query given SQL to create a prepared statement from SQL and a
582-
* list of arguments to bind to the query, expecting a result object.
581+
* Query given SQL to create a prepared statement from SQL and a list of
582+
* arguments to bind to the query, expecting a result object.
583583
* <p>The query is expected to be a single row/single column query; the returned
584584
* result will be directly mapped to the corresponding object type.
585585
* @param sql the SQL query to execute
@@ -597,8 +597,8 @@ <T> T queryForObject(String sql, Object[] args, int[] argTypes, Class<T> require
597597
<T> T queryForObject(String sql, Object[] args, Class<T> requiredType) throws DataAccessException;
598598

599599
/**
600-
* Query given SQL to create a prepared statement from SQL and a
601-
* list of arguments to bind to the query, expecting a result object.
600+
* Query given SQL to create a prepared statement from SQL and a list of
601+
* arguments to bind to the query, expecting a result object.
602602
* <p>The query is expected to be a single row/single column query; the returned
603603
* result will be directly mapped to the corresponding object type.
604604
* @param sql the SQL query to execute
@@ -617,8 +617,8 @@ <T> T queryForObject(String sql, Object[] args, int[] argTypes, Class<T> require
617617
<T> T queryForObject(String sql, Class<T> requiredType, Object... args) throws DataAccessException;
618618

619619
/**
620-
* Query given SQL to create a prepared statement from SQL and a
621-
* list of arguments to bind to the query, expecting a result Map.
620+
* Query given SQL to create a prepared statement from SQL and a list of
621+
* arguments to bind to the query, expecting a result map.
622622
* <p>The query is expected to be a single row query; the result row will be
623623
* mapped to a Map (one entry for each column, using the column name as the key).
624624
* @param sql the SQL query to execute
@@ -636,11 +636,11 @@ <T> T queryForObject(String sql, Object[] args, int[] argTypes, Class<T> require
636636
Map<String, Object> queryForMap(String sql, Object[] args, int[] argTypes) throws DataAccessException;
637637

638638
/**
639-
* Query given SQL to create a prepared statement from SQL and a
640-
* list of arguments to bind to the query, expecting a result Map.
641-
* The queryForMap() methods defined by this interface are appropriate
642-
* when you don't have a domain model. Otherwise, consider using
643-
* one of the queryForObject() methods.
639+
* Query given SQL to create a prepared statement from SQL and a list of
640+
* arguments to bind to the query, expecting a result map.
641+
* <p>The {@code queryForMap} methods defined by this interface are appropriate
642+
* when you don't have a domain model. Otherwise, consider using one of the
643+
* {@code queryForObject} methods.
644644
* <p>The query is expected to be a single row query; the result row will be
645645
* mapped to a Map (one entry for each column, using the column name as the key).
646646
* @param sql the SQL query to execute
@@ -659,8 +659,8 @@ <T> T queryForObject(String sql, Object[] args, int[] argTypes, Class<T> require
659659
Map<String, Object> queryForMap(String sql, Object... args) throws DataAccessException;
660660

661661
/**
662-
* Query given SQL to create a prepared statement from SQL and a
663-
* list of arguments to bind to the query, expecting a result list.
662+
* Query given SQL to create a prepared statement from SQL and a list of
663+
* arguments to bind to the query, expecting a result list.
664664
* <p>The results will be mapped to a List (one entry for each row) of
665665
* result objects, each of them matching the specified element type.
666666
* @param sql the SQL query to execute
@@ -674,12 +674,12 @@ <T> T queryForObject(String sql, Object[] args, int[] argTypes, Class<T> require
674674
* @see #queryForList(String, Class)
675675
* @see SingleColumnRowMapper
676676
*/
677-
<T>List<T> queryForList(String sql, Object[] args, int[] argTypes, Class<T> elementType)
677+
<T> List<T> queryForList(String sql, Object[] args, int[] argTypes, Class<T> elementType)
678678
throws DataAccessException;
679679

680680
/**
681-
* Query given SQL to create a prepared statement from SQL and a
682-
* list of arguments to bind to the query, expecting a result list.
681+
* Query given SQL to create a prepared statement from SQL and a list of
682+
* arguments to bind to the query, expecting a result list.
683683
* <p>The results will be mapped to a List (one entry for each row) of
684684
* result objects, each of them matching the specified element type.
685685
* @param sql the SQL query to execute
@@ -697,8 +697,8 @@ <T>List<T> queryForList(String sql, Object[] args, int[] argTypes, Class<T> elem
697697
<T> List<T> queryForList(String sql, Object[] args, Class<T> elementType) throws DataAccessException;
698698

699699
/**
700-
* Query given SQL to create a prepared statement from SQL and a
701-
* list of arguments to bind to the query, expecting a result list.
700+
* Query given SQL to create a prepared statement from SQL and a list of
701+
* arguments to bind to the query, expecting a result list.
702702
* <p>The results will be mapped to a List (one entry for each row) of
703703
* result objects, each of them matching the specified element type.
704704
* @param sql the SQL query to execute
@@ -717,12 +717,12 @@ <T>List<T> queryForList(String sql, Object[] args, int[] argTypes, Class<T> elem
717717
<T> List<T> queryForList(String sql, Class<T> elementType, Object... args) throws DataAccessException;
718718

719719
/**
720-
* Query given SQL to create a prepared statement from SQL and a
721-
* list of arguments to bind to the query, expecting a result list.
720+
* Query given SQL to create a prepared statement from SQL and a list of
721+
* arguments to bind to the query, expecting a result list.
722722
* <p>The results will be mapped to a List (one entry for each row) of
723723
* Maps (one entry for each column, using the column name as the key).
724-
* Thus Each element in the list will be of the form returned by this interface's
725-
* queryForMap() methods.
724+
* Each element in the list will be of the form returned by this interface's
725+
* {@code queryForMap} methods.
726726
* @param sql the SQL query to execute
727727
* @param args arguments to bind to the query
728728
* @param argTypes the SQL types of the arguments
@@ -735,12 +735,12 @@ <T>List<T> queryForList(String sql, Object[] args, int[] argTypes, Class<T> elem
735735
List<Map<String, Object>> queryForList(String sql, Object[] args, int[] argTypes) throws DataAccessException;
736736

737737
/**
738-
* Query given SQL to create a prepared statement from SQL and a
739-
* list of arguments to bind to the query, expecting a result list.
738+
* Query given SQL to create a prepared statement from SQL and a list of
739+
* arguments to bind to the query, expecting a result list.
740740
* <p>The results will be mapped to a List (one entry for each row) of
741741
* Maps (one entry for each column, using the column name as the key).
742742
* Each element in the list will be of the form returned by this interface's
743-
* queryForMap() methods.
743+
* {@code queryForMap} methods.
744744
* @param sql the SQL query to execute
745745
* @param args arguments to bind to the query
746746
* (leaving it to the PreparedStatement to guess the corresponding SQL type);
@@ -753,8 +753,8 @@ <T>List<T> queryForList(String sql, Object[] args, int[] argTypes, Class<T> elem
753753
List<Map<String, Object>> queryForList(String sql, Object... args) throws DataAccessException;
754754

755755
/**
756-
* Query given SQL to create a prepared statement from SQL and a
757-
* list of arguments to bind to the query, expecting a SqlRowSet.
756+
* Query given SQL to create a prepared statement from SQL and a list of
757+
* arguments to bind to the query, expecting a SqlRowSet.
758758
* <p>The results will be mapped to an SqlRowSet which holds the data in a
759759
* disconnected fashion. This wrapper will translate any SQLExceptions thrown.
760760
* <p>Note that, for the default implementation, JDBC RowSet support needs to
@@ -776,8 +776,8 @@ <T>List<T> queryForList(String sql, Object[] args, int[] argTypes, Class<T> elem
776776
SqlRowSet queryForRowSet(String sql, Object[] args, int[] argTypes) throws DataAccessException;
777777

778778
/**
779-
* Query given SQL to create a prepared statement from SQL and a
780-
* list of arguments to bind to the query, expecting a SqlRowSet.
779+
* Query given SQL to create a prepared statement from SQL and a list of
780+
* arguments to bind to the query, expecting a SqlRowSet.
781781
* <p>The results will be mapped to an SqlRowSet which holds the data in a
782782
* disconnected fashion. This wrapper will translate any SQLExceptions thrown.
783783
* <p>Note that, for the default implementation, JDBC RowSet support needs to
@@ -799,8 +799,9 @@ <T>List<T> queryForList(String sql, Object[] args, int[] argTypes, Class<T> elem
799799
SqlRowSet queryForRowSet(String sql, Object... args) throws DataAccessException;
800800

801801
/**
802-
* Issue a single SQL update operation (such as an insert, update or delete statement)
803-
* using a PreparedStatementCreator to provide SQL and any required parameters.
802+
* Issue a single SQL update operation (such as an insert, update or delete
803+
* statement) using a PreparedStatementCreator to provide SQL and any
804+
* required parameters.
804805
* <p>A PreparedStatementCreator can either be implemented directly or
805806
* configured through a PreparedStatementCreatorFactory.
806807
* @param psc a callback that provides SQL and any necessary parameters

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,12 +1145,12 @@ public Map<String, Object> doInCallableStatement(CallableStatement cs) throws SQ
11451145
logger.debug("CallableStatement.execute() returned '" + retVal + "'");
11461146
logger.debug("CallableStatement.getUpdateCount() returned " + updateCount);
11471147
}
1148-
Map<String, Object> returnedResults = createResultsMap();
1148+
Map<String, Object> resultsMap = createResultsMap();
11491149
if (retVal || updateCount != -1) {
1150-
returnedResults.putAll(extractReturnedResults(cs, updateCountParameters, resultSetParameters, updateCount));
1150+
resultsMap.putAll(extractReturnedResults(cs, updateCountParameters, resultSetParameters, updateCount));
11511151
}
1152-
returnedResults.putAll(extractOutputParameters(cs, callParameters));
1153-
return returnedResults;
1152+
resultsMap.putAll(extractOutputParameters(cs, callParameters));
1153+
return resultsMap;
11541154
}
11551155
});
11561156
}
@@ -1283,8 +1283,8 @@ protected Map<String, Object> processResultSet(ResultSet rs, ResultSetSupporting
12831283
}
12841284
if (param.getRowMapper() != null) {
12851285
RowMapper rowMapper = param.getRowMapper();
1286-
Object result = (new RowMapperResultSetExtractor(rowMapper)).extractData(rsToUse);
1287-
return Collections.singletonMap(param.getName(), result);
1286+
Object data = (new RowMapperResultSetExtractor(rowMapper)).extractData(rsToUse);
1287+
return Collections.singletonMap(param.getName(), data);
12881288
}
12891289
else if (param.getRowCallbackHandler() != null) {
12901290
RowCallbackHandler rch = param.getRowCallbackHandler();
@@ -1293,8 +1293,8 @@ else if (param.getRowCallbackHandler() != null) {
12931293
(Object) "ResultSet returned from stored procedure was processed");
12941294
}
12951295
else if (param.getResultSetExtractor() != null) {
1296-
Object result = param.getResultSetExtractor().extractData(rsToUse);
1297-
return Collections.singletonMap(param.getName(), result);
1296+
Object data = param.getResultSetExtractor().extractData(rsToUse);
1297+
return Collections.singletonMap(param.getName(), data);
12981298
}
12991299
}
13001300
finally {

0 commit comments

Comments
 (0)