Skip to content

Conversation

@schauder
Copy link
Contributor

@schauder schauder commented Mar 19, 2020

While reviewing #170 I realised various more cases and ended up doing more changes than the original PR. Therefore I'd like to get another review of the changes.

Issue: https://jira.spring.io/browse/DATAJDBC-341

@schauder schauder requested a review from mp911de March 19, 2020 16:12
*
* @author Jens Schauder
*/
class ResultSetWrapper {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typically, we use a PropertyValueProvider to wrap the actual source.

for (int i = 1; i <= columnCount; i++) {

String label = metaData.getColumnLabel(i).toLowerCase();
Integer previous = index.put(label, i);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per JDBC spec: Encountering a column label more than once, then the first label is used. I'd suggest a case-insensitive Set<String> (see LinkedCaseInsensitiveMap) to check for column names.

THD-Thomas-Lang and others added 4 commits March 30, 2020 19:55
…ng fetched in the query. Original pull request: #170.
Turns out this was a little more involved than expected. This modifies the implementation to not use exceptions for flow control. Properties that get set via setter, wither or field access get not invoked for missing columns. When properties get referenced in constructors a missing column results in an exception. As a side effect we now access the `ResultSet` by index. Depending on how the driver is implemented this might improve the performance a little.
ResultSetWrapper now uses the first column when multiple columns with the same effective name exist. It employs a LinkedCaseInsensitiveMap for storing the mapping columnnames to indexes.
Introduced two differen PropertyValueProvider implementations in order to encapsulate the two variants how ResultSets get accessed.
mp911de pushed a commit that referenced this pull request Mar 31, 2020
Turns out this was a little more involved than expected. This modifies the implementation to not use exceptions for flow control. Properties that get set via setter, wither or field access get not invoked for missing columns. When properties get referenced in constructors a missing column results in an exception. As a side effect we now access the `ResultSet` by index. Depending on how the driver is implemented this might improve the performance a little. Original pull request: #201.
mp911de added a commit that referenced this pull request Mar 31, 2020
Remove SpecialColumnValue in favor of JdbcPropertyValueProvider.hasProperty(…). Rename ResultSetWrapper to ResultSetAccessor. Replace ResultSetAccessor usage in JdbcConverter with ResultSet to avoid visibility issues. Original pull request: #201.
@mp911de
Copy link
Member

mp911de commented Mar 31, 2020

That's merged and polished now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants