Skip to content

Allow passing of tuples to methods #1838

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed

Conversation

schauder
Copy link
Contributor

Closes #1323

To be honest, I'm not sure if this is the right way to fix this. Could you take a hard critical look, please?

@schauder
Copy link
Contributor Author

#1569 seems related.

@@ -204,23 +207,47 @@ private void convertAndAddParameter(MapSqlParameterSource parameters, Parameter
TypeInformation<?> typeInformation = parameter.getTypeInformation();

JdbcValue jdbcValue;
if (typeInformation.isCollectionLike() && value instanceof Collection<?>) {
if (typeInformation.isCollectionLike() //
Copy link
Member

Choose a reason for hiding this comment

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

We should make our concepts more explicit. Binding a single value is fine. Binding a List should become more explicit what we're up to. Binding a list of elements would result in parameter expansion while binding a list of arrays results in tuple expansion.

I suggest that we refactor the code a bit into a form that we extract methods and prepare the target types (i.e. actual type) so that we have a more explicit flow.

Let me know what you think.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm happy with that.
Are you thinking refactoring in the strict sense, i.e. we keep the behaviour as it is with this PR?

Refactor convertAndAddParameter method to writeValue(…) decoupling responsibilities for a clearer value conversion code path. Also, refactor collection conversion to functional callback-style and extend test assertions.
@mp911de mp911de added the type: bug A general bug label Jul 22, 2024
@mp911de mp911de added this to the 3.2.9 (2023.1.9) milestone Jul 22, 2024
@mp911de mp911de added type: regression A regression from a previous release and removed type: bug A general bug labels Jul 22, 2024
mp911de pushed a commit that referenced this pull request Jul 22, 2024
mp911de added a commit that referenced this pull request Jul 22, 2024
Refactor convertAndAddParameter method to writeValue(…) decoupling responsibilities for a clearer value conversion code path. Also, refactor collection conversion to functional callback-style and extend test assertions.

See #1323
Original pull request: #1838
mp911de pushed a commit that referenced this pull request Jul 22, 2024
mp911de added a commit that referenced this pull request Jul 22, 2024
Refactor convertAndAddParameter method to writeValue(…) decoupling responsibilities for a clearer value conversion code path. Also, refactor collection conversion to functional callback-style and extend test assertions.

See #1323
Original pull request: #1838
mp911de pushed a commit that referenced this pull request Jul 22, 2024
mp911de added a commit that referenced this pull request Jul 22, 2024
Refactor convertAndAddParameter method to writeValue(…) decoupling responsibilities for a clearer value conversion code path. Also, refactor collection conversion to functional callback-style and extend test assertions.

See #1323
Original pull request: #1838
@mp911de
Copy link
Member

mp911de commented Jul 22, 2024

That's merged and backported now.

@mp911de mp911de closed this Jul 22, 2024
@mp911de mp911de deleted the issue/1323-in-with-tuple branch July 22, 2024 13:19
mp911de added a commit that referenced this pull request Jul 23, 2024
Correctly assign SQL type for tuples.

See #1323
Original pull request: #1838
mp911de added a commit that referenced this pull request Jul 23, 2024
Correctly assign SQL type for tuples.

See #1323
Original pull request: #1838
mp911de added a commit that referenced this pull request Jul 23, 2024
Correctly assign SQL type for tuples.

See #1323
Original pull request: #1838
mp911de added a commit that referenced this pull request Jul 23, 2024
Correctly assign SQL type for tuples.

See #1323
Original pull request: #1838
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: regression A regression from a previous release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Query methods with tuple bind parameter List<String[]> does no longer work
2 participants