Skip to content

databaseClient.batchUpdate like good old JdbcTemplate #315

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
yuranos opened this issue Mar 3, 2020 · 2 comments
Closed

databaseClient.batchUpdate like good old JdbcTemplate #315

yuranos opened this issue Mar 3, 2020 · 2 comments
Labels
status: invalid An issue that we don't feel is valid

Comments

@yuranos
Copy link

yuranos commented Mar 3, 2020

Maybe I missed something but it seems there's no easy way to do it right now via databaseClient.
I found several examples with bare r2dbc like this one, but it's obviously not ideal.

I don't want to concatenate the entire query into a String because it will mean I also need to provide a manual SQL Injection check.

As an option, I'm currently considering adding indexing to binding names(which is quite succinct in Kotlin), but there should be a better option.

@mp911de
Copy link
Member

mp911de commented Mar 5, 2020

Batching in R2DBC supports either multiple unparametrized statements via io.r2dbc.Batch or by running a single parametrized statement multiple times.

Most database implementations concatenate the unparametrized statements to batch into a single query separated with ;.

Our DatabaseClient indeed lacks support for R2DBC's Statement.add() to run a parametrized statements with different binding sets. Would that help in your use-case?

@mp911de mp911de added the type: enhancement A general enhancement label Mar 5, 2020
@mp911de mp911de added status: invalid An issue that we don't feel is valid and removed type: enhancement A general enhancement labels Jul 14, 2020
@mp911de
Copy link
Member

mp911de commented Jul 14, 2020

We're going to rebase Spring Data R2DBC on top of Spring R2DBC with #368, therefore it would make sense to add support for batch updates in Spring R2DBC (which is part of Spring Framework) directly.

@mp911de mp911de closed this as completed Jul 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

2 participants