Use numbered indices in list arguments for async postgresql queries #3579
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Queries with "IN" use the
createArguments
function at runtime to generate an argument list consisting of the correct number of questionmarks.In #3559 the BindParameterMixin was introduced to replace questionsmarks with numbered indices for queries generated with the postgresql dialect when the
R2dbcDriver
is used. This change did not include the dynamic generation of argument lists at runtime.This PR introduces a new helper function
createNumberedArguments
and changes the code generation to switch between this and the already existingcreateArguments
function depending on the dialect and if async queries are to be used.Also, if numbered indices are used, each query in a transactions uses a seperate ${name}Indexes variable due to probably different offsets. It may be possible to optimize them away in some cases if the offsets are stored and only one variable per list argument and offset is created. I did not attempt to write this optimization since I expect the code to become significantly more complicated for an insignificant performance gain.