CachedRowSetImpl doesn't allow for column label use (SPR-7506).
Looking up values by labels in RowSet is supported by ResultSetWrappingSqlRowSet, with fallback to wrapped ResultSet if nothing found. Unfortunately it works in case-sensitive manner (HashMap
Assume there is a table: CREATE TABLE T(col int)
And code: SqlRowSet srs = jdbcTemplate.queryForRowSet(query); if ( srs.next() ) srs.getInt("col"); // do smth with value
Queries: 1. select col from T -- ok, column name here, and column name == column label 2. select 0 as col from T -- ok, column label, cache in ResultSetWrappingSqlRowSet handle this 3. select 0 as Col from T -- error, column name != column label, + cache miss 3.1. column name != column label 3.2. code in ResultSetWrappingSqlRowSet can't find column by label, because "col" != "Col" 3.3. wrapped ResultSet (RowSet, CachedRowSetImpl) can't find column by name, because there is no column name
This commit change column-label treatment to case-insensitive.
Comment From: pivotal-issuemaster
@navol Please sign the Contributor License Agreement!
Click here to manually synchronize the status of this Pull Request.
See the FAQ for frequently asked questions.
Comment From: pivotal-issuemaster
@navol Thank you for signing the Contributor License Agreement!
Comment From: snicoll
@navol thank you for the PR and sorry it took so long to process it.
The behavior of dealing with case insensitive values should be explicit. JdbcTemplate
has a setResultsMapCaseInsensitive
to turn this feature on/off and looking at SqlRowSet
I think we should keep things as they are.