mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-14 17:23:27 -05:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user