-
Notifications
You must be signed in to change notification settings - Fork 332
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
Strange effect when mixing escaped variable names + parameters #589
Comments
problem in SqlParser.cs line 111. fixed code:
|
Thanks for the suggested fix, but I suspect that will break actual escaped named parameters. (Although it's an interesting question of how those should be named on the C# side: should the parameter name include the backticks or not?) |
This also likely relates to #195. |
Connector/NET 8.0.13 Behaviourusing (var cmd = new MySqlCommand(STATEMENT, connection))
{
cmd.Parameters.AddWithValue(C# PARAM NAME, 1);
cmd.ExecuteScalar();
Desired BehaviourJust as both In general, MySQL's identifier de-escaping rules should be applied to the |
Fixed in 0.48.0. |
UPD. Every time someone use escaped user defined variable names into query all parameter values become NULL;
Just add this to you query and all parameters become NULL:
OR
OR
All of these commands executed in single transaction in both MySqlConnector and Oracle’s Connector/NET. Every time DbParameter name = foo, value=22, type=int64 is supplied:
SET @'var':=1;
SELECT @'var' as R
returns 1 for both providers
SELECT @foo as R
returns 22 for both providers
SET @'var':=1;
SELECT @foo+@'var' as R
returns 23 for Oracle, DbNull for MySqlConnector
SET @'var':=1;
SELECT @foo+1 as R
returns 23 for Oracle, DbNull for MySqlConnector
SET @'var':=@foo+1;
SELECT @'var' as R
returns 23 for Oracle, DbNull for MySqlConnector
please note this behavior differs only when I'm using ESCAPED variable names (using "" or '' etc) https://dev.mysql.com/doc/refman/8.0/en/user-variables.html
IE any times I mix BOTH parameters and user-defined variables WITH ESCAPED name I got nulls
The text was updated successfully, but these errors were encountered: