Fix 5519 var args with r2dbc driver #5523
Draft
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.
fix #5519
🦥 In Progress
I think the only place in SqlDelight that generates Sql at runtime is to expand var args to
IN (?, ?,...)
🛞 The Driver and Dialect are responsible for any specific implementation of runtime argument binding
⚡ Transacter feels like the wrong place for generating runtime sql. Keep existing
createArguments
as there is a lot of test code generated and instead forward to the Driver implementation🚨 MySql/MariaDb R2dbc uses
?
and PostgreSql R2dbc uses$1, $2 ...
makes it difficult to determine the argument binding needed as we need to know the dialect and drivercreateArguments
is part of Driver/Dialect behaviour - PostgreSql native R2dbc has specific bind argument and reference by position and index. If you were manually using the driver to execute sql thencreateArguments
should be part of that?
bindingTransacter.createArguments
forward toDriver.createArguments
so there is no change to compiled coderuntime.api
andandroid.api
andjdbc.api
PostgresqlR2dbcDriver
to overridecreateArguments
for special caseSqlDriver
unless we really need it then could open and inherit fromR2dbcDriver
IN ?
Example client use
Note: This is different than the fix for #5319 where the expansion of
INSERT VALUES
var args can be known at compile time.