Files
sqltoolsservice/src/Microsoft.SqlTools.ServiceLayer/QueryExecution/Contracts/SelectionData.cs
Benjamin Russell d5fbebc287 Progressive Results Part 1: Batch Completion Notification (#95)
The main feature of this pull request is a new callback that's added to the query class that is called when a batch has completed execution and retrieval of results. This callback will send an event to the extension with the batch summary information. After that, the extension can submit subset requests for the resultsets of the batch.
Other smaller changes in this pull request:
Refactor to assign a batch a id when its created instead of when returning the list of batch summaries
Passing the SelectionData around instead of extracting the values for it
Moving creation of BatchSummary into the Batch class
Retrieval of results is now permitted even if the entire query has not completed, as long as the batch requested has completed.
Also note, this does not break the protocol. It adds a new event that a queryRunner can listen to, but it doesn't require it to be listened to.

* Refactor to remove SectionData class in favor of BufferRange

* Adding callback for batch completion that will let the extension know that a batch has completed execution

* Refactoring to make progressive results work as per async query execution

* Allowing retrieval of batch results while query is in progress

* reverting global.json, whoops

* Adding a few missing comments, and fixing a couple code style bugs

* Using SelectionData everywhere again

* One more missing comment
2016-11-02 17:43:38 -07:00

53 lines
1.4 KiB
C#

//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using Microsoft.SqlTools.ServiceLayer.Workspace.Contracts;
namespace Microsoft.SqlTools.ServiceLayer.QueryExecution.Contracts
{
/// <summary>
/// Container class for a selection range from file
/// </summary>
/// TODO: Remove this in favor of buffer range end-to-end
public class SelectionData
{
public SelectionData() { }
public SelectionData(int startLine, int startColumn, int endLine, int endColumn)
{
StartLine = startLine;
StartColumn = startColumn;
EndLine = endLine;
EndColumn = endColumn;
}
#region Properties
public int EndColumn { get; set; }
public int EndLine { get; set; }
public int StartColumn { get; set; }
public int StartLine { get; set; }
#endregion
public BufferRange ToBufferRange()
{
return new BufferRange(StartLine, StartColumn, EndLine, EndColumn);
}
public static SelectionData FromBufferRange(BufferRange range)
{
return new SelectionData
{
StartLine = range.Start.Line,
StartColumn = range.Start.Column,
EndLine = range.End.Line,
EndColumn = range.End.Column
};
}
}
}