Fix for displaying multiple table (#1075)

This commit is contained in:
rajeshka
2020-09-17 11:59:01 -07:00
committed by GitHub
parent c80b70bea4
commit df0be31019
3 changed files with 55 additions and 57 deletions

View File

@@ -1,21 +1,27 @@
using System.Data;
using Microsoft.Kusto.ServiceLayer.QueryExecution;
using System.Collections.Generic;
using System.Data;
namespace Microsoft.Kusto.ServiceLayer.DataSource
{
internal class KustoResultsReader : DataReaderWrapper
{
public KustoResultsReader(IDataReader reader) : base(reader)
public KustoResultsReader(IDataReader reader)
: base(reader)
{
}
/// <summary>
/// Kusto returns 3 results tables - QueryResults, QueryProperties, QueryStatus. When returning query results
/// we want the caller to only read the first table. We override the NextResult function here to only return one table
/// from the IDataReader.
/// </summary>
public override bool NextResult()
{
return false;
/// Kusto returns atleast 4 results tables - QueryResults(sometimes more than one), QueryProperties, QueryStatus and Query Results Metadata Table.
/// When returning query results we need to trim off the last 3 tables as we want the caller to only read results table.
/// </summary>
public void SanitizeResults(List<ResultSet> resultSets)
{
if (resultSets.Count > 3)
{
resultSets.RemoveRange(resultSets.Count - 3, 3);
}
}
}
}