Batch Start Notification (#169)

This change is part of the progressive results code. It will submit a notification from the service layer to indicate when execution of a batch has completed. This notification will contain the selection for batch, execution start time, and its ID. This will enable the extension to produce a header for the batch before the batch completes, in order to make it more clear to the user that execution is going on.

* Adding new event for batch start

* Unit tests

* Fixing comments as per @kevcunnane
This commit is contained in:
Benjamin Russell
2016-12-08 11:23:08 -08:00
committed by GitHub
parent ab97948005
commit 54f30887cc
7 changed files with 293 additions and 104 deletions

View File

@@ -99,10 +99,15 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution
/// </summary>
public event Batch.BatchAsyncEventHandler BatchCompleted;
/// <summary>
/// Event to be called when a batch starts execution.
/// </summary>
public event Batch.BatchAsyncEventHandler BatchStarted;
/// <summary>
/// Delegate type for callback when a query connection fails
/// </summary>
/// <param name="q">The query that completed</param>
/// <param name="message">Error message for the failing query</param>
public delegate Task QueryAsyncErrorEventHandler(string message);
/// <summary>
@@ -277,6 +282,7 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution
// We need these to execute synchronously, otherwise the user will be very unhappy
foreach (Batch b in Batches)
{
b.BatchStart += BatchStarted;
b.BatchCompletion += BatchCompleted;
b.ResultSetCompletion += ResultSetCompleted;
await b.Execute(conn, cancellationSource.Token);