diff --git a/nuget.config b/nuget.config index 933ad9ee..edd564a3 100644 --- a/nuget.config +++ b/nuget.config @@ -1,14 +1,6 @@ - - - - - - - - + - diff --git a/src/Microsoft.SqlTools.ServiceLayer/QueryExecution/Batch.cs b/src/Microsoft.SqlTools.ServiceLayer/QueryExecution/Batch.cs index e4b5d666..5fb927cd 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/QueryExecution/Batch.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/QueryExecution/Batch.cs @@ -124,6 +124,9 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution // Add the result set to the results of the query ResultSets.Add(resultSet); + + // Add a message for the number of rows the query returned + ResultMessages.Add(string.Format(RowsAffectedFormat, resultSet.Rows.Count)); } while (await reader.NextResultAsync(cancellationToken)); } } diff --git a/src/Microsoft.SqlTools.ServiceLayer/QueryExecution/Query.cs b/src/Microsoft.SqlTools.ServiceLayer/QueryExecution/Query.cs index 2470dd11..4451cc48 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/QueryExecution/Query.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/QueryExecution/Query.cs @@ -21,6 +21,8 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution /// public class Query : IDisposable { + private const string RowsAffectedFormat = "({0} row(s) affected)"; + #region Properties /// diff --git a/src/Microsoft.SqlTools.ServiceLayer/project.json b/src/Microsoft.SqlTools.ServiceLayer/project.json index b690fd26..0cfc0788 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/project.json +++ b/src/Microsoft.SqlTools.ServiceLayer/project.json @@ -7,7 +7,7 @@ }, "dependencies": { "Newtonsoft.Json": "9.0.1", - "Microsoft.SqlServer.SqlParser": "140.1.3", + "Microsoft.SqlServer.SqlParser": "140.1.4", "System.Data.Common": "4.1.0", "System.Data.SqlClient": "4.1.0" }, diff --git a/test/Microsoft.SqlTools.ServiceLayer.Test/QueryExecution/Common.cs b/test/Microsoft.SqlTools.ServiceLayer.Test/QueryExecution/Common.cs index ae2bf49f..e9777f27 100644 --- a/test/Microsoft.SqlTools.ServiceLayer.Test/QueryExecution/Common.cs +++ b/test/Microsoft.SqlTools.ServiceLayer.Test/QueryExecution/Common.cs @@ -107,7 +107,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Test.QueryExecution ServerName = "sqltools11" }; - return new ConnectionInfo(CreateMockFactory(data, throwOnRead), "test://test", connDetails); + return new ConnectionInfo(CreateMockFactory(data, throwOnRead), OwnerUri, connDetails); } #endregion diff --git a/test/Microsoft.SqlTools.ServiceLayer.Test/QueryExecution/ExecuteTests.cs b/test/Microsoft.SqlTools.ServiceLayer.Test/QueryExecution/ExecuteTests.cs index e9dd96e3..b26ba4a4 100644 --- a/test/Microsoft.SqlTools.ServiceLayer.Test/QueryExecution/ExecuteTests.cs +++ b/test/Microsoft.SqlTools.ServiceLayer.Test/QueryExecution/ExecuteTests.cs @@ -381,6 +381,9 @@ namespace Microsoft.SqlTools.ServiceLayer.Test.QueryExecution //VerifyQueryExecuteCallCount(requestContext, Times.Once(), Times.Never(), Times.Never()); //Assert.NotNull(result.Messages); //Assert.NotEmpty(result.Messages); + + // ... There should not be an active query + Assert.Empty(queryService.ActiveQueries); } //[Fact] diff --git a/test/Microsoft.SqlTools.ServiceLayer.Test/Utility/TestDbDataReader.cs b/test/Microsoft.SqlTools.ServiceLayer.Test/Utility/TestDbDataReader.cs index 69edef72..e2003789 100644 --- a/test/Microsoft.SqlTools.ServiceLayer.Test/Utility/TestDbDataReader.cs +++ b/test/Microsoft.SqlTools.ServiceLayer.Test/Utility/TestDbDataReader.cs @@ -91,6 +91,12 @@ namespace Microsoft.SqlTools.ServiceLayer.Test.Utility public override int FieldCount { get { return Rows?.Current.Count ?? 0; } } + public override int RecordsAffected + { + // Mimics the behavior of SqlDataReader + get { return Rows != null ? -1 : 1; } + } + #region Not Implemented public override bool GetBoolean(int ordinal) @@ -200,7 +206,6 @@ namespace Microsoft.SqlTools.ServiceLayer.Test.Utility public override int Depth { get; } public override bool IsClosed { get; } - public override int RecordsAffected { get; } #endregion }