Unit tests, part 1

This commit is contained in:
Benjamin Russell
2016-08-05 18:38:21 -07:00
parent a5582889bf
commit 9f371cd0bc
5 changed files with 431 additions and 191 deletions

View File

@@ -84,19 +84,25 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution
{
do
{
// Create a new result set that we'll use to store all the data
ResultSet resultSet = new ResultSet();
if (reader.CanGetColumnSchema())
// TODO: This doesn't properly handle scenarios where the query is SELECT but does not have rows
if (!reader.HasRows)
{
resultSet.Columns = reader.GetColumnSchema().ToArray();
continue;
}
// Read until we hit the end of the result set
ResultSet resultSet = new ResultSet();
while (await reader.ReadAsync(cancellationSource.Token))
{
resultSet.AddRow(reader);
}
// Read off the column schema information
if (reader.CanGetColumnSchema())
{
resultSet.Columns = reader.GetColumnSchema().ToArray();
}
// Add the result set to the results of the query
ResultSets.Add(resultSet);
} while (await reader.NextResultAsync(cancellationSource.Token));