query/executeString (#217)

This is a small API addition that allows us to execute queries directly as strings. This will make it easier to execute queries outside the confines of a workspace like VS Code.

* Refactor execution requests and events are now named less redundantly and moved into a separate namespace for organization. This is the bulk of the changes.
    * QueryExecuteBatchNotification -> ExecuteRequests/BatchEvents
    * QueryExecuteMessageNotification -> ExecuteRequests/MessageEvent
    * QueryExecuteCompleteNotification -> ExecuteRequests/QueryCompleteEvent
    * QueryExecuteResultSetCompleteNotification -> ExecuteRequests/ResultSetEvents
    * QueryExecuteSubsetRequest -> SubsetRequest.cs
* Creating an inheritance pattern where
    * `ExecuteRequestParamsBase` has execution options and ID for a query execute request
    * `ExecuteDocumentSelectionParams` inherits from `ExecuteRequestParamsBase` and provides a document selection
    * `ExecuteStringParams`  inherits from `ExecuteRequestParamsBase` and provides the query text
* Adding a helper method to get SQL text based on request type
* Through the AWESOME POWER OF POLYMORPHISM, we are able to create a request for executing straight SQL basically for free.
* **Breaking change:** query/execute => query/executeDocumentSelection to make it more obvious what is expected.
* Adding unit tests for the code that gets SQL text

* Refactoring of execute contracts into their own namespace

* Refactoring application

* Adding new request for executing queries as strings

* Adding forgotten string request

* Changing the logic for checking the request param types

* Removing redundant declarations
This commit is contained in:
Benjamin Russell
2017-01-30 15:24:12 -08:00
committed by GitHub
parent 41d38b2107
commit 857b526553
22 changed files with 428 additions and 274 deletions

View File

@@ -84,7 +84,7 @@ namespace Microsoft.SqlTools.ServiceLayer.TestDriver.Tests
}
// Run n queries at once
var queryTasks = new Task<QueryExecuteCompleteParams>[queryCount];
var queryTasks = new Task<QueryCompleteParams>[queryCount];
for (int i = 0; i < queryCount; i++)
{
queryTasks[i] = TestService.RunQuery(ownerUris[i].FilePath, query);
@@ -160,7 +160,7 @@ namespace Microsoft.SqlTools.ServiceLayer.TestDriver.Tests
await TestService.RunQuery(queryTempFile.FilePath, query);
// Spawn several tasks for subset requests
var subsetTasks = new Task<QueryExecuteSubsetResult>[100];
var subsetTasks = new Task<SubsetResult>[100];
for (int i = 0; i < 100; i++)
{
subsetTasks[i] = TestService.ExecuteSubset(queryTempFile.FilePath, 0, 0, 0, 100);
@@ -259,7 +259,7 @@ namespace Microsoft.SqlTools.ServiceLayer.TestDriver.Tests
}
}
var subsetRequest = new QueryExecuteSubsetParams()
var subsetRequest = new SubsetParams()
{
OwnerUri = queryTempFile.FilePath,
BatchIndex = 0,