Skip to content

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

@Northcode

Description

@Northcode

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions