Fixing by moving the result submission to before execution starts (#204)

This commit is contained in:
Benjamin Russell
2016-12-30 13:30:05 -08:00
committed by GitHub
parent 323374d123
commit a8d627b07c

View File

@@ -154,7 +154,7 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution
Query newQuery = await CreateAndActivateNewQuery(executeParams, requestContext);
// Execute the query -- asynchronously
await ExecuteAndCompleteQuery(executeParams, requestContext, newQuery);
ExecuteAndCompleteQuery(executeParams, requestContext, newQuery);
}
/// <summary>
@@ -369,6 +369,12 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution
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;
}
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
if (query == null)
@@ -451,18 +457,6 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution
// Launch this as an asynchronous task
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,