Add rowcount check so that no results error is sent for a query where no rows are returned (#525)

This commit is contained in:
Kevin Cunnane
2017-10-25 12:06:22 -07:00
committed by Karl Burtram
parent 3d7b87eca2
commit 3392f93a2e

View File

@@ -229,13 +229,15 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution
try try
{ {
// check to make sure any results were recieved // check to make sure any results were recieved
if (query.Batches.Length == 0 || query.Batches[0].ResultSets.Count == 0) if (query.Batches.Length == 0
|| query.Batches[0].ResultSets.Count == 0
|| query.Batches[0].ResultSets[0].RowCount == 0)
{ {
await requestContext.SendError(SR.QueryServiceResultSetHasNoResults); await requestContext.SendError(SR.QueryServiceResultSetHasNoResults);
return; return;
} }
var rowCount = query.Batches[0].ResultSets[0].RowCount; long rowCount = query.Batches[0].ResultSets[0].RowCount;
// check to make sure there is a safe amount of rows to load into memory // check to make sure there is a safe amount of rows to load into memory
if (rowCount > Int32.MaxValue) if (rowCount > Int32.MaxValue)
{ {