Skip to content
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

Enable CLIENT_FOUND_ROWS in r2dbc-mysql in favor of spring-data-r2dbc #240

Closed
ks-yim opened this issue Jul 6, 2021 · 6 comments
Closed

Comments

@ks-yim
Copy link

ks-yim commented Jul 6, 2021

After spring-projects/spring-data-r2dbc#253, spring-data-r2dbc assumes CLIENT_FOUND_ROWS capability flag is enabled for its mysql connections.

This causes a problem with jasync-r2dbc-mysql as a backing driver for spring-data-r2dbc when we try to save an unchanged entity...:

val fooRepository: R2dbcRepository<FooEntity, Int>

// throws an exception since `affectedRows` evaluates to 0 in MySQL without `CLIENT_FOUND_ROWS` flag.
fooRepository.save(fooRepository.findById(1))

It would be nice if there's an option to enable CLIENT_FOUND_ROWS flag in MySqlConnection.kt to enable it in MySqlConnectionFactoryProvider#create.

@github-actions
Copy link

github-actions bot commented Jul 6, 2021

Thank you for reporting an issue. See the wiki for documentation and gitter for questions.

@oshai
Copy link
Contributor

oshai commented Jul 7, 2021

Thanks for raising the issue. I'll need to investigate how to implement that, and will try to do that when possible.

@ks-yim
Copy link
Author

ks-yim commented Jul 23, 2021

It seems there's no easy way of overriding capability flags. We can add related properties to Configuration class but it feels awkward since they only have meanings in MySQL context.

One potential hack is to detect a spring-data-r2dbc(or R2DBC) related class in the classpath and cache the result upon class loading and conditionally enable CLIENT_FOUND_FOWS flag depending on the result.

@oshai
Copy link
Contributor

oshai commented Aug 23, 2021

created PR #247

@oshai
Copy link
Contributor

oshai commented Aug 24, 2021

Fix is in version 1.2.3.

@ks-yim
Copy link
Author

ks-yim commented Aug 25, 2021

Thanks!

@ks-yim ks-yim closed this as completed Aug 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants