mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-17 09:35:37 -05:00
Handling NOCOUNT being set (#96)
After much thinking, this change brings the message behavior into line with SSMS, including if the NOCOUNT is set. This is a somewhat non-obvious solution, but the StatementCompleted event handler will only be fired if there is a record count to return. We'll add the message for number of records if the StatementCompleted event is fired, otherwise we won't add any messages while processing the resultsets of the batch. If any messages are returned from the server, we'll capture those. Then, if at the end of the batch, we haven't collected any messages from StatementCompleted events or server messages, then we'll add the "completed successfully" message. This matches behavior of SSMS that will only emit a "completed successfully" message if there were no other messages for the batch. * Solution to issue, some unit tests needed to be tweaked * Comments for the event handler
This commit is contained in:
@@ -73,9 +73,6 @@ namespace Microsoft.SqlTools.ServiceLayer.Test.QueryExecution
|
||||
|
||||
// ... There should be a message for how many rows were affected
|
||||
Assert.Equal(1, batch.ResultMessages.Count());
|
||||
Assert.Contains("1 ", batch.ResultMessages.First().Message);
|
||||
// NOTE: 1 is expected because this test simulates a 'update' statement where 1 row was affected.
|
||||
// The 1 in quotes is to make sure the 1 isn't part of a larger number
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -107,7 +104,6 @@ namespace Microsoft.SqlTools.ServiceLayer.Test.QueryExecution
|
||||
|
||||
// ... There should be a message for how many rows were affected
|
||||
Assert.Equal(resultSets, batch.ResultMessages.Count());
|
||||
Assert.Contains(Common.StandardRows.ToString(), batch.ResultMessages.First().Message);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -149,13 +145,6 @@ namespace Microsoft.SqlTools.ServiceLayer.Test.QueryExecution
|
||||
// ... Inside each result summary, there should be 5 column definitions
|
||||
Assert.Equal(Common.StandardColumns, rs.ColumnInfo.Length);
|
||||
}
|
||||
|
||||
// ... There should be a message for how many rows were affected
|
||||
Assert.Equal(resultSets, batch.ResultMessages.Count());
|
||||
foreach (var rsm in batch.ResultMessages)
|
||||
{
|
||||
Assert.Contains(Common.StandardRows.ToString(), rsm.Message);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
Reference in New Issue
Block a user