-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add ValuesListBoundStatement for handling Values list statements #234
Add ValuesListBoundStatement for handling Values list statements #234
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 5 files at r1, all commit messages.
Reviewable status: 1 of 5 files reviewed, 2 unresolved discussions (waiting on @tristanvuong2021)
src/main/kotlin/org/wfanet/measurement/common/db/r2dbc/StatementBuilder.kt
line 23 at r2 (raw file):
/** An interface for creating a R2DBC [Statement]. */ interface StatementBuilder {
This shouldn't be called StatementBuilder
, as the builder pattern involves a mutable object. What we want to pass to the transaction context is an immutable object that has already been "built".
Note that converting to a Statement
is not "building".
src/main/kotlin/org/wfanet/measurement/common/db/r2dbc/postgres/ValuesListBoundStatement.kt
line 159 at r2 (raw file):
/** Builds a [ValuesListBoundStatement] from this builder. */ fun build(): ValuesListBoundStatement {
This should ultimately be building a BoundStatement. That is to say that we don't need a different BoundStatement type, but rather a separate DSL builder interface for building BoundStatements using value lists.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 5 files reviewed, 2 unresolved discussions (waiting on @SanjayVas)
src/main/kotlin/org/wfanet/measurement/common/db/r2dbc/postgres/ValuesListBoundStatement.kt
line 159 at r2 (raw file):
Previously, SanjayVas (Sanjay Vasandani) wrote…
This should ultimately be building a BoundStatement. That is to say that we don't need a different BoundStatement type, but rather a separate DSL builder interface for building BoundStatements using value lists.
Done.
src/main/kotlin/org/wfanet/measurement/common/db/r2dbc/StatementBuilder.kt
line 23 at r2 (raw file):
Previously, SanjayVas (Sanjay Vasandani) wrote…
This shouldn't be called
StatementBuilder
, as the builder pattern involves a mutable object. What we want to pass to the transaction context is an immutable object that has already been "built".Note that converting to a
Statement
is not "building".
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 4 files at r2, 4 of 4 files at r3, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @tristanvuong2021)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 4 files at r2, 4 of 4 files at r3, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @tristanvuong2021)
The addBinding function ends up creating a separate query for every set of bindings. See pgjdbc/r2dbc-postgresql#527. When there are a lot of inserts or updates, this severely affects performance. This PR adds a class that has a similar function as addBinding, but instead uses a values list to create a single query for multiple inserts or updates.