mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-30 01:25:45 -05:00
Make query execution truly asynchronous (#83)
The two main changes in this pull request: Launching query execution as an asynchronous task that performs a callback upon completion or failure of a query. (Which also sets us up for callbacks progressive results) Moving away from using the Result of a query execution to return an error. Instead we'll use an error event to return an error Additionally, some nice refactoring and cleaning up of the unit tests to take advantage of the cool RequestContext mock tooling by @kevcunnane * Initial commit of refactor to run execution truely asynchronously * Moving the storage of the task into Query class Callbacks for completion of a query and failure of a query are setup as events in the Query class. This actually sets us up for a very nice framework for adding batch and resultset completion callbacks. However, this also exposes a problem with cancelling queries and returning errors -- we don't properly handle errors during execution of a query (aside from DB errors). * Wrapping things up in order to submit for code review * Adding fixes as per comments
This commit is contained in:
@@ -165,6 +165,14 @@ namespace Microsoft.SqlTools.ServiceLayer
|
||||
}
|
||||
}
|
||||
|
||||
public static string QueryServiceQueryCancelled
|
||||
{
|
||||
get
|
||||
{
|
||||
return Keys.GetString(Keys.QueryServiceQueryCancelled);
|
||||
}
|
||||
}
|
||||
|
||||
public static string QueryServiceSubsetNotCompleted
|
||||
{
|
||||
get
|
||||
@@ -363,6 +371,11 @@ namespace Microsoft.SqlTools.ServiceLayer
|
||||
return Keys.GetString(Keys.QueryServiceErrorFormat, msg, lvl, state, line, newLine, message);
|
||||
}
|
||||
|
||||
public static string QueryServiceQueryFailed(string message)
|
||||
{
|
||||
return Keys.GetString(Keys.QueryServiceQueryFailed, message);
|
||||
}
|
||||
|
||||
public static string WorkspaceServicePositionColumnOutOfRange(int line)
|
||||
{
|
||||
return Keys.GetString(Keys.WorkspaceServicePositionColumnOutOfRange, line);
|
||||
@@ -376,7 +389,7 @@ namespace Microsoft.SqlTools.ServiceLayer
|
||||
[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
public class Keys
|
||||
{
|
||||
static ResourceManager resourceManager = new ResourceManager(typeof(SR));
|
||||
static ResourceManager resourceManager = new ResourceManager("Microsoft.SqlTools.ServiceLayer.SR", typeof(SR).GetTypeInfo().Assembly);
|
||||
|
||||
static CultureInfo _culture = null;
|
||||
|
||||
@@ -444,6 +457,9 @@ namespace Microsoft.SqlTools.ServiceLayer
|
||||
public const string QueryServiceCancelDisposeFailed = "QueryServiceCancelDisposeFailed";
|
||||
|
||||
|
||||
public const string QueryServiceQueryCancelled = "QueryServiceQueryCancelled";
|
||||
|
||||
|
||||
public const string QueryServiceSubsetNotCompleted = "QueryServiceSubsetNotCompleted";
|
||||
|
||||
|
||||
@@ -480,6 +496,9 @@ namespace Microsoft.SqlTools.ServiceLayer
|
||||
public const string QueryServiceErrorFormat = "QueryServiceErrorFormat";
|
||||
|
||||
|
||||
public const string QueryServiceQueryFailed = "QueryServiceQueryFailed";
|
||||
|
||||
|
||||
public const string QueryServiceColumnNull = "QueryServiceColumnNull";
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user