diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 849d9cd0f69..686b6dde535 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,49 +1,49 @@ - + https://github.com/dotnet/runtime - 03e90a540cb2dfe5cab4086ea54ad5dd1f655749 + 733a3089ec6945422caf06035c18ff700c9d51be - + https://github.com/dotnet/runtime - 03e90a540cb2dfe5cab4086ea54ad5dd1f655749 + 733a3089ec6945422caf06035c18ff700c9d51be - + https://github.com/dotnet/runtime - 03e90a540cb2dfe5cab4086ea54ad5dd1f655749 + 733a3089ec6945422caf06035c18ff700c9d51be - + https://github.com/dotnet/runtime - 03e90a540cb2dfe5cab4086ea54ad5dd1f655749 + 733a3089ec6945422caf06035c18ff700c9d51be - + https://github.com/dotnet/runtime - 03e90a540cb2dfe5cab4086ea54ad5dd1f655749 + 733a3089ec6945422caf06035c18ff700c9d51be - + https://github.com/dotnet/runtime - 03e90a540cb2dfe5cab4086ea54ad5dd1f655749 + 733a3089ec6945422caf06035c18ff700c9d51be - + https://github.com/dotnet/runtime - 03e90a540cb2dfe5cab4086ea54ad5dd1f655749 + 733a3089ec6945422caf06035c18ff700c9d51be - + https://github.com/dotnet/runtime - 03e90a540cb2dfe5cab4086ea54ad5dd1f655749 + 733a3089ec6945422caf06035c18ff700c9d51be - + https://github.com/dotnet/runtime - 03e90a540cb2dfe5cab4086ea54ad5dd1f655749 + 733a3089ec6945422caf06035c18ff700c9d51be - + https://github.com/dotnet/runtime - 03e90a540cb2dfe5cab4086ea54ad5dd1f655749 + 733a3089ec6945422caf06035c18ff700c9d51be - + https://github.com/dotnet/runtime - 03e90a540cb2dfe5cab4086ea54ad5dd1f655749 + 733a3089ec6945422caf06035c18ff700c9d51be diff --git a/eng/Versions.props b/eng/Versions.props index b5bac126f67..53c8d7f70ac 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -15,17 +15,17 @@ False - 7.0.0-alpha.1.21501.7 - 7.0.0-alpha.1.21501.7 - 7.0.0-alpha.1.21501.7 - 7.0.0-alpha.1.21501.7 - 7.0.0-alpha.1.21501.7 - 7.0.0-alpha.1.21501.7 - 7.0.0-alpha.1.21501.7 - 7.0.0-alpha.1.21501.7 - 7.0.0-alpha.1.21501.7 - 7.0.0-alpha.1.21501.7 - 7.0.0-alpha.1.21501.7 + 6.0.0-rtm.21507.16 + 6.0.0-rtm.21507.16 + 6.0.0-rtm.21507.16 + 6.0.0-rtm.21507.16 + 6.0.0-rtm.21507.16 + 6.0.0-rtm.21507.16 + 6.0.0-rtm.21507.16 + 6.0.0-rtm.21507.16 + 6.0.0-rtm.21507.16 + 6.0.0-rtm.21507.16 + 6.0.0-rtm.21507.16 3.7.0 diff --git a/src/Microsoft.Data.Sqlite.Core/SqliteCommand.cs b/src/Microsoft.Data.Sqlite.Core/SqliteCommand.cs index 53e3bcf6675..e5c48517079 100644 --- a/src/Microsoft.Data.Sqlite.Core/SqliteCommand.cs +++ b/src/Microsoft.Data.Sqlite.Core/SqliteCommand.cs @@ -322,12 +322,15 @@ private IEnumerable GetStatements(Stopwatch timer) ? PrepareAndEnumerateStatements(timer) : _preparedStatements) { + var boundParams = _parameters?.Bind(stmt) ?? 0; var expectedParams = sqlite3_bind_parameter_count(stmt); + if (expectedParams != boundParams) { var unboundParams = new List(); + for (var i = 1; i <= expectedParams; i++) { var name = sqlite3_bind_parameter_name(stmt, i).utf8_to_string(); diff --git a/src/Microsoft.Data.Sqlite.Core/SqliteParameter.cs b/src/Microsoft.Data.Sqlite.Core/SqliteParameter.cs index 265634b0100..5a36c55211b 100644 --- a/src/Microsoft.Data.Sqlite.Core/SqliteParameter.cs +++ b/src/Microsoft.Data.Sqlite.Core/SqliteParameter.cs @@ -211,6 +211,23 @@ internal bool Bind(sqlite3_stmt stmt) } var index = sqlite3_bind_parameter_index(stmt, ParameterName); + + if(index == 0) + { + var expectedParams = sqlite3_bind_parameter_count(stmt); + + for (var i = 1; i <= expectedParams; i++) + { + var name = sqlite3_bind_parameter_name(stmt, i).utf8_to_string(); + + if (String.Compare(ParameterName, name, StringComparison.OrdinalIgnoreCase) == 0) + { + index = i; + break; + } + } + } + if (index == 0 && (index = FindPrefixedParameter(stmt)) == 0) { diff --git a/src/Microsoft.Data.Sqlite.Core/SqliteParameterCollection.cs b/src/Microsoft.Data.Sqlite.Core/SqliteParameterCollection.cs index 6ec9439a7a3..5bd0654f7fc 100644 --- a/src/Microsoft.Data.Sqlite.Core/SqliteParameterCollection.cs +++ b/src/Microsoft.Data.Sqlite.Core/SqliteParameterCollection.cs @@ -328,11 +328,22 @@ protected override void SetParameter(string parameterName, DbParameter value) internal int Bind(sqlite3_stmt stmt) { var bound = 0; + var checkedParams = new List(); + foreach (var parameter in _parameters) { - if (parameter.Bind(stmt)) + if(!checkedParams.Cast().Any(p => p.ParameterName.Equals(parameter.ParameterName, StringComparison.OrdinalIgnoreCase))) + { + if (parameter.Bind(stmt)) + { + bound++; + + checkedParams.Add(parameter); + } + } + else { - bound++; + throw new InvalidOperationException(Resources.AmbiguousParameterName(parameter.ParameterName)); } } diff --git a/test/Microsoft.Data.Sqlite.Tests/SqliteParameterTest.cs b/test/Microsoft.Data.Sqlite.Tests/SqliteParameterTest.cs index 630b49d382d..ca54260f0ad 100644 --- a/test/Microsoft.Data.Sqlite.Tests/SqliteParameterTest.cs +++ b/test/Microsoft.Data.Sqlite.Tests/SqliteParameterTest.cs @@ -433,6 +433,22 @@ public void Bind_does_not_require_prefix(string parameterName) } } + [Fact] + public void Bind_is_not_case_sensitive() + { + using (var connection = new SqliteConnection("Data Source=:memory:")) + { + var command = connection.CreateCommand(); + command.CommandText = "SELECT @param"; + command.Parameters.AddWithValue("@Param", "harvest"); + connection.Open(); + + var result = command.ExecuteScalar(); + + Assert.Equal("harvest", result); + } + } + [Fact] public void Bind_throws_for_ambiguous_parameters() {