-
Notifications
You must be signed in to change notification settings - Fork 10
Config option to allow custom parameter syntax #78
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
Conversation
Would this negate the need for #77 or does beekeeper want both? I'm assuming the need here is that beekeeper wants to allow people to specify variables in any format or something regardless of what the database itself usually uses for parameters? |
@MasterOdin I believe it would yes. I actually didn't see that PR till I filed this one (oops), but the idea here was to have the same config schema as sql-formatter, so that objects could be passed to both (as sql-formatter can replace the params). This also provides more options. And yes the hope is to have parameters be agnostic of db type. Seems that in general is confused many users, and we already replace parameters before the query gets to the driver anyways |
I've implemented the requested changes, minus how we classify params that fail to be scanned in A couple things:
|
@not-night-but I think we should adhere to specs - so if SQLite has 4 different supported param types, that is what we should show. We can always increment the version if we feel like it's a bigger break |
Yeah, making sqlite adhere more closely to the spec, and just returning more correctly for variable identification seems like a minor release, especially since supporting positional variables shouldn't change, would only affect people using a mix of variable types, but feels like we're incorrect in that instance. |
@MasterOdin @rathboma Implemented the changes:
|
Signed-off-by: Matthew Peveler <[email protected]>
positional?: boolean; | ||
numbered?: ('?' | ':' | '$')[]; | ||
named?: (':' | '@' | '$')[]; | ||
quoted?: (':' | '@' | '$')[]; |
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.
Confirming that there is not any error checking if someone passes a value that's not in this array of values? I'm fine merging this as is, and then making my own PR doing this.
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.
Correct. There is no error checking besides typescript type checking
This follows the same syntax that is allowed by sql-formatter, which we use in beekeeper-studio