Skip to content

Support unbounded parameter limit #2349

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
wants to merge 2 commits into from
Closed

Conversation

deryrahman
Copy link

In version 2, setting up query_parameter_limit to -1 is not working. As per explanation in this reference, it should accepts limit of positional arguments with value -1.

And I think there should be a correction of what value -1 must behave. Instead of always emit struct (like value 1 does), it should generates the code with complete positional arguments.

@kyleconroy
Copy link
Collaborator

0 is actually a valid setting. When zero is set, queries will always have a struct. Can we update this to only make changes for -1?

@deryrahman
Copy link
Author

deryrahman commented Jun 24, 2023

hi @kyleconroy , sure. Just want to clarify, so what is the definition of query_parameter_limit ? In my interpretation, it's used to set the maximum number of parameters that would be generated.

So, set the query parameter limit to n, where n > 0, if the number of parameter is p and p<=n, then, the parameters will use data type per individual parameter, otherwise (p>n), use a struct.

Set to -1 to make the parameters always use data type per individual parameter

@deryrahman
Copy link
Author

Just seeing your latest fix. Understood now, sqlc doesn't support always emit all positional arguments (-1) as I expected (though I've just realized that emitting all args is bad practice). Sorry for misinterpretation. Agree to close this PR 👍

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.

2 participants