mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-17 02:51:45 -05:00
Fixing by moving the result submission to before execution starts (#204)
This commit is contained in:
@@ -154,7 +154,7 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution
|
|||||||
Query newQuery = await CreateAndActivateNewQuery(executeParams, requestContext);
|
Query newQuery = await CreateAndActivateNewQuery(executeParams, requestContext);
|
||||||
|
|
||||||
// Execute the query -- asynchronously
|
// Execute the query -- asynchronously
|
||||||
await ExecuteAndCompleteQuery(executeParams, requestContext, newQuery);
|
ExecuteAndCompleteQuery(executeParams, requestContext, newQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -369,6 +369,12 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Send the result stating that the query was successfully started
|
||||||
|
await requestContext.SendResult(new QueryExecuteResult
|
||||||
|
{
|
||||||
|
Messages = newQuery.Batches.Length == 0 ? SR.QueryServiceCompletedSuccessfully : null
|
||||||
|
});
|
||||||
|
|
||||||
return newQuery;
|
return newQuery;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
@@ -378,7 +384,7 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async Task ExecuteAndCompleteQuery(QueryExecuteParams executeParams, RequestContext<QueryExecuteResult> requestContext, Query query)
|
private static void ExecuteAndCompleteQuery(QueryExecuteParams executeParams, RequestContext<QueryExecuteResult> requestContext, Query query)
|
||||||
{
|
{
|
||||||
// Skip processing if the query is null
|
// Skip processing if the query is null
|
||||||
if (query == null)
|
if (query == null)
|
||||||
@@ -451,18 +457,6 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution
|
|||||||
|
|
||||||
// Launch this as an asynchronous task
|
// Launch this as an asynchronous task
|
||||||
query.Execute();
|
query.Execute();
|
||||||
|
|
||||||
// Send back a result showing we were successful
|
|
||||||
string messages = null;
|
|
||||||
if (query.Batches.Length == 0)
|
|
||||||
{
|
|
||||||
// If there were no batches to execute, send back an informational message that the commands were completed successfully
|
|
||||||
messages = SR.QueryServiceCompletedSuccessfully;
|
|
||||||
}
|
|
||||||
await requestContext.SendResult(new QueryExecuteResult
|
|
||||||
{
|
|
||||||
Messages = messages
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task SaveResultsHelper(SaveResultsRequestParams saveParams,
|
private async Task SaveResultsHelper(SaveResultsRequestParams saveParams,
|
||||||
|
|||||||
Reference in New Issue
Block a user