mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
Polishing
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -52,13 +52,12 @@ public class ColumnMapRowMapper implements RowMapper<Map<String, Object>> {
|
||||
public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
|
||||
ResultSetMetaData rsmd = rs.getMetaData();
|
||||
int columnCount = rsmd.getColumnCount();
|
||||
Map<String, Object> mapOfColValues = createColumnMap(columnCount);
|
||||
Map<String, Object> mapOfColumnValues = createColumnMap(columnCount);
|
||||
for (int i = 1; i <= columnCount; i++) {
|
||||
String key = getColumnKey(JdbcUtils.lookupColumnName(rsmd, i));
|
||||
Object obj = getColumnValue(rs, i);
|
||||
mapOfColValues.put(key, obj);
|
||||
String column = JdbcUtils.lookupColumnName(rsmd, i);
|
||||
mapOfColumnValues.put(getColumnKey(column), getColumnValue(rs, i));
|
||||
}
|
||||
return mapOfColValues;
|
||||
return mapOfColumnValues;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
-1
@@ -253,7 +253,6 @@ public class TableMetaDataContext {
|
||||
for (Map.Entry<String, ?> entry : inParameters.entrySet()) {
|
||||
if (column.equalsIgnoreCase(entry.getKey())) {
|
||||
value = entry.getValue();
|
||||
// TODO: break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ import org.springframework.jdbc.CannotGetJdbcConnectionException;
|
||||
import org.springframework.jdbc.datasource.DataSourceUtils;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.NumberUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Generic utility methods for working with JDBC. Mainly for internal use
|
||||
@@ -452,7 +453,7 @@ public abstract class JdbcUtils {
|
||||
*/
|
||||
public static String lookupColumnName(ResultSetMetaData resultSetMetaData, int columnIndex) throws SQLException {
|
||||
String name = resultSetMetaData.getColumnLabel(columnIndex);
|
||||
if (name == null || name.length() < 1) {
|
||||
if (!StringUtils.hasLength(name)) {
|
||||
name = resultSetMetaData.getColumnName(columnIndex);
|
||||
}
|
||||
return name;
|
||||
|
||||
Reference in New Issue
Block a user