Skip to content
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

AseCommand/AseParameterCollection does not throw if parameters contains duplicate keys #192

Closed
Northcode opened this issue Aug 20, 2020 · 0 comments · Fixed by #197
Closed
Assignees
Labels
Milestone

Comments

@Northcode
Copy link
Contributor

Northcode commented Aug 20, 2020

Describe the bug
Sybase does not allow for duplicate parameters in commands.
Trying to execute them will at best give you an exception from sybase, at worst (how I discovered this) it won't return anything in the socket connection, causing AseClient to think the socket closed. (this was a bit annoying to debug).

To Reproduce

var _aseCommand = connection.CreateCommand("select @p1, @p2");
_aseCommand.Parameters.Add("@p1", "test");
_aseCommand.Parameters.Add("@p2", "test2");
_aseCommand.Parameters.Add("@p1", "test3");
var reader = _aseCommand.ExecuteReader();

Expected behavior
Either AseCommand.ExecuteReader or AseParameterCollection.Add should throw ArgumentException when a duplicate key is used.

Environment

  • .NET Framework/Core version Core 3.1
  • AdoNetCore.AseClient nuget package version: 0.18.0, assembly version: 0.11.0.0

Additional context

@ngvtien ngvtien self-assigned this Sep 4, 2020
@ngvtien ngvtien added this to the 0.19.2 milestone Sep 5, 2020
ngvtien pushed a commit to ngvtien/AdoNetCore.AseClient that referenced this issue Sep 5, 2020
…ess issue # 188 by include the IsUnique as well as IsKey in the validation to determine hasKey

Address issue DataAction#192 for duplicate parameter name
Update test cases
ngvtien added a commit that referenced this issue Feb 10, 2021
@ngvtien ngvtien linked a pull request Feb 10, 2021 that will close this issue
@ngvtien ngvtien closed this as completed Feb 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants