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