-
Notifications
You must be signed in to change notification settings - Fork 331
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
Change AllowUserVariables default to true #194
Comments
Looks like this was a breaking change introduced in 5.2.x that's caused problems for people because it's not obvious why disallowing user variables should be the default behaviour. All |
More users assuming this is a bug in the MySql.Data connector: |
I would like to look into this a little more, should have time in a few more days |
More users reporting this default behaviour as a bug: In the first bug, a maintainer explains:
However, this still doesn't explain why the default behaviour was chosen. |
More users reporting it as a bug:
From bug 40765:
This isn't a very convincing rationale. There's a hint in this archived documentation:
And from Connection String Options Reference:
Then, from the 5.2.0 release notes:
From an old mailing list post:
And one final piece of old documentation:
Here's what appears to have happened:
This may have made sense for users who upgraded existing code through multiple versions of Connector/Net, but I think it's confusing for new users, particularly if they're coming from a different ADO.NET provider. (Note that Connector/J has a lot of properties but it doesn't expose any option like this as far as I can tell. It seems to have come from the development history of Connector/Net.) My recommendation is to default this connection string setting to |
I would argue that this is in fact a convincing rationale. Most use cases that I see do not use user variables. Consider what happens when the programmer forgets to bind a variable in their code or has a typo in the bound variable name:
With
With
Comparison with other languages: Maybe this is a bit of a non-issue in drivers for other languages because bound parameters do not use the leading Recommendation My recommendation is to leave the default at For those programmers who do need user variables, the issues that @bgrainger has pointed are indexed on Google and the likes, and should hopefully be quick to figure out. |
I had the (incorrect) assumption that MySQL Server itself would reject We could even add something like "Set AllowUserVariables=true in your connection string..." to the exception message to help people solve the problem without googling. |
Can't this be changed by configuration? So we can use |
In what way? Are you proposing that a new
I disagree (well, as long as it's not actually done via string concatenation). Here's an example of another library adjusting the user-provided connection string to enable the settings it needs: #600 (comment) (One could choose to silently update it, throw an exception, etc.) |
Possibility to configure programatically the use of As you already metioned, it's an edge case and I dont want break our abstraction for one reason. |
As mentioned in #193, the default value for
Allow User Variables
isfalse
, to match MySql.Data. Is this still a good default? (It feels like unexpected behaviour to me.) Would it be a major breaking change to make ittrue
by default?The text was updated successfully, but these errors were encountered: