Skip to content

Conversation

mightyguava
Copy link
Owner

@mightyguava mightyguava commented Jan 28, 2020

JDBC seems to only support positional parameters like ?. I had to write a HACK to convert numbered parameters like $1 to ?. This is buggy and terrible. It also means that you can't use $1 multiple times in the same query to reference the same value.

This is a better change that examines the AST and edits the parser in the parsing step.

The Kotlin generation has a few extra nuances. The number of parameters no longer directly corresponds to the number of columns in the struct (data class) generated, since numbered parameters can be used multiple times. I work around it here by adding a new JDBCParamBindings field to KtQueryValues that contains the full list of bindings that need to be passed to the driver. The existing KtQueryValues.Fields is used to generate the struct.

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

Successfully merging this pull request may close these issues.

1 participant