Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,23 @@ public ResultSetWrappingSqlRowSet(ResultSet resultSet) throws InvalidResultSetAc
ResultSetMetaData rsmd = resultSet.getMetaData();
if (rsmd != null) {
int columnCount = rsmd.getColumnCount();
this.columnLabelMap = CollectionUtils.newHashMap(columnCount);
this.columnLabelMap = CollectionUtils.newHashMap(columnCount * 2);
for (int i = 1; i <= columnCount; i++) {
String key = rsmd.getColumnLabel(i);
// Make sure to preserve first matching column for any given name,
// as defined in ResultSet's type-level javadoc (lines 81 to 83).
if (!this.columnLabelMap.containsKey(key)) {
this.columnLabelMap.put(key, i);
}
// Also support column names prefixed with table name
// as in {table_name}.{column.name}.
String table = rsmd.getTableName(i);
if (table != null && !table.isEmpty()) {
key = table + "." + rsmd.getColumnName(i);
if (!this.columnLabelMap.containsKey(key)) {
this.columnLabelMap.put(key, i);
}
}
}
}
else {
Expand Down