Adding support for query cancellation

Query cancellation support is added via CancellationToken mechanisms that
were implemented previously. This change adds a new request type
"query/cancel" that will issue the cancellation token. Unit tests were
also added.
This commit is contained in:
Benjamin Russell
2016-08-15 15:23:07 -07:00
parent 3981b1d544
commit 062c40368d
4 changed files with 221 additions and 0 deletions

View File

@@ -233,6 +233,21 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution
};
}
/// <summary>
/// Cancels the query by issuing the cancellation token
/// </summary>
public void Cancel()
{
// Make sure that the query hasn't completed execution
if (HasExecuted)
{
throw new InvalidOperationException("The query has already completed, it cannot be cancelled.");
}
// Issue the cancellation token for the query
cancellationSource.Cancel();
}
/// <summary>
/// Delegate handler for storing messages that are returned from the server
/// NOTE: Only messages that are below a certain severity will be returned via this