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

@@ -443,17 +443,28 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution
query.QueryFailed += callback;
query.QueryConnectionException += errorCallback;
// Setup the batch completion callback
Batch.BatchAsyncEventHandler batchCallback = async b =>
// Setup the batch callbacks
Batch.BatchAsyncEventHandler batchStartCallback = async b =>
{
QueryExecuteBatchCompleteParams eventParams = new QueryExecuteBatchCompleteParams
QueryExecuteBatchNotificationParams eventParams = new QueryExecuteBatchNotificationParams
{
BatchSummary = b.Summary,
OwnerUri = executeParams.OwnerUri
};
await requestContext.SendEvent(QueryExecuteBatchStartEvent.Type, eventParams);
};
query.BatchStarted += batchStartCallback;
Batch.BatchAsyncEventHandler batchCompleteCallback = async b =>
{
QueryExecuteBatchNotificationParams eventParams = new QueryExecuteBatchNotificationParams
{
BatchSummary = b.Summary,
OwnerUri = executeParams.OwnerUri
};
await requestContext.SendEvent(QueryExecuteBatchCompleteEvent.Type, eventParams);
};
query.BatchCompleted += batchCallback;
query.BatchCompleted += batchCompleteCallback;
// Setup the ResultSet completion callback
ResultSet.ResultSetAsyncEventHandler resultCallback = async r =>