diff --git a/docs/samples/jsonrpc/netcore/executequery/Driver/ClientDriver.cs b/docs/samples/jsonrpc/netcore/executequery/Driver/ClientDriver.cs index 929ade64..e3e63bd7 100644 --- a/docs/samples/jsonrpc/netcore/executequery/Driver/ClientDriver.cs +++ b/docs/samples/jsonrpc/netcore/executequery/Driver/ClientDriver.cs @@ -14,7 +14,7 @@ using Microsoft.SqlTools.Hosting.Protocol.Channel; using Microsoft.SqlTools.ServiceLayer.Connection.Contracts; using Microsoft.SqlTools.ServiceLayer.LanguageServices.Contracts; using Microsoft.SqlTools.ServiceLayer.QueryExecution.Contracts; - +using Microsoft.SqlTools.ServiceLayer.QueryExecution.Contracts.ExecuteRequests; namespace Microsoft.SqlTools.JsonRpc.Driver { /// @@ -59,6 +59,7 @@ namespace Microsoft.SqlTools.JsonRpc.Driver startTime = DateTime.Now; // Launch the process + this.protocolClient.Initialize(); await this.protocolClient.Start(); await Task.Delay(1000); // Wait for the service host to start @@ -67,7 +68,7 @@ namespace Microsoft.SqlTools.JsonRpc.Driver // Setup events to queue for testing this.QueueEventsForType(ConnectionCompleteNotification.Type); this.QueueEventsForType(IntelliSenseReadyNotification.Type); - this.QueueEventsForType(QueryExecuteCompleteEvent.Type); + this.QueueEventsForType(QueryCompleteEvent.Type); this.QueueEventsForType(PublishDiagnosticsNotification.Type); } diff --git a/docs/samples/jsonrpc/netcore/executequery/Program.cs b/docs/samples/jsonrpc/netcore/executequery/Program.cs index abfacc2e..3baf6439 100644 --- a/docs/samples/jsonrpc/netcore/executequery/Program.cs +++ b/docs/samples/jsonrpc/netcore/executequery/Program.cs @@ -8,6 +8,7 @@ using System.Threading.Tasks; using Microsoft.SqlTools.JsonRpc.Utility; using Microsoft.SqlTools.ServiceLayer.Connection.Contracts; using Microsoft.SqlTools.ServiceLayer.QueryExecution.Contracts; +using Microsoft.SqlTools.ServiceLayer.QueryExecution.Contracts.ExecuteRequests; namespace Microsoft.SqlTools.JsonRpc.ExecuteQuery { @@ -19,10 +20,11 @@ namespace Microsoft.SqlTools.JsonRpc.ExecuteQuery internal static void Main(string[] args) { // set SQLTOOLSSERVICE_EXE to location of SQL Tools Service executable - Environment.SetEnvironmentVariable("SQLTOOLSSERVICE_EXE", @"Microsoft.SqlTools.ServiceLayer.exe"); + Environment.SetEnvironmentVariable("SQLTOOLSSERVICE_EXE", @"MicrosoftSqlToolsServiceLayer.exe"); // execute a query against localhost, master, with IntegratedAuth ExecuteQuery("SELECT * FROM sys.objects").Wait(); + } internal static async Task ExecuteQuery(string query) @@ -43,7 +45,7 @@ namespace Microsoft.SqlTools.JsonRpc.ExecuteQuery await testHelper.Connect(queryTempFile.FilePath, connectParams); // execute the query - QueryExecuteCompleteParams queryComplete = + QueryCompleteParams queryComplete = await testHelper.RunQuery(queryTempFile.FilePath, query); if (queryComplete.BatchSummaries != null && queryComplete.BatchSummaries.Length > 0) @@ -54,7 +56,7 @@ namespace Microsoft.SqlTools.JsonRpc.ExecuteQuery var resultSet = batch.ResultSetSummaries[0]; // retrive the results - QueryExecuteSubsetResult querySubset = await testHelper.ExecuteSubset( + SubsetResult querySubset = await testHelper.ExecuteSubset( queryTempFile.FilePath, batch.Id, resultSet.Id, 0, (int)resultSet.RowCount); @@ -70,7 +72,7 @@ namespace Microsoft.SqlTools.JsonRpc.ExecuteQuery { for (int i = 0; i < resultSet.ColumnInfo.Length; ++i) { - Console.Write(row.GetValue(i) + ", "); + Console.Write(row[i].DisplayValue + ", "); } Console.Write(Environment.NewLine); } diff --git a/docs/samples/jsonrpc/netcore/executequery/Utility/ClientHelper.cs b/docs/samples/jsonrpc/netcore/executequery/Utility/ClientHelper.cs index 54f81c68..65d9d8b6 100644 --- a/docs/samples/jsonrpc/netcore/executequery/Utility/ClientHelper.cs +++ b/docs/samples/jsonrpc/netcore/executequery/Utility/ClientHelper.cs @@ -13,6 +13,7 @@ using Microsoft.SqlTools.ServiceLayer.LanguageServices.Contracts; using Microsoft.SqlTools.ServiceLayer.QueryExecution.Contracts; using Microsoft.SqlTools.ServiceLayer.SqlContext; using Microsoft.SqlTools.ServiceLayer.Workspace.Contracts; +using Microsoft.SqlTools.ServiceLayer.QueryExecution.Contracts.ExecuteRequests; namespace Microsoft.SqlTools.JsonRpc.Utility { @@ -119,9 +120,9 @@ namespace Microsoft.SqlTools.JsonRpc.Utility /// /// Request the active SQL script is parsed for errors /// - public async Task RequestQueryExecuteSubset(QueryExecuteSubsetParams subsetParams) + public async Task RequestQueryExecuteSubset(SubsetParams subsetParams) { - return await Driver.SendRequest(QueryExecuteSubsetRequest.Type, subsetParams); + return await Driver.SendRequest(SubsetRequest.Type, subsetParams); } /// @@ -171,21 +172,21 @@ namespace Microsoft.SqlTools.JsonRpc.Utility /// /// Run a query using a given connection bound to a URI /// - public async Task RunQuery(string ownerUri, string query, int timeoutMilliseconds = 5000) + public async Task RunQuery(string ownerUri, string query, int timeoutMilliseconds = 5000) { // Write the query text to a backing file WriteToFile(ownerUri, query); - var queryParams = new QueryExecuteParams + var queryParams = new ExecuteDocumentSelectionParams { OwnerUri = ownerUri, QuerySelection = null }; - var result = await Driver.SendRequest(QueryExecuteRequest.Type, queryParams); - if (result != null && string.IsNullOrEmpty(result.Messages)) + var result = await Driver.SendRequest(ExecuteDocumentSelectionRequest.Type, queryParams); + if (result != null) { - var eventResult = await Driver.WaitForEvent(QueryExecuteCompleteEvent.Type, timeoutMilliseconds); + var eventResult = await Driver.WaitForEvent(QueryCompleteEvent.Type, timeoutMilliseconds); return eventResult; } else @@ -231,16 +232,16 @@ namespace Microsoft.SqlTools.JsonRpc.Utility /// /// Request a subset of results from a query /// - public async Task ExecuteSubset(string ownerUri, int batchIndex, int resultSetIndex, int rowStartIndex, int rowCount) + public async Task ExecuteSubset(string ownerUri, int batchIndex, int resultSetIndex, int rowStartIndex, int rowCount) { - var subsetParams = new QueryExecuteSubsetParams(); + var subsetParams = new SubsetParams(); subsetParams.OwnerUri = ownerUri; subsetParams.BatchIndex = batchIndex; subsetParams.ResultSetIndex = resultSetIndex; subsetParams.RowsStartIndex = rowStartIndex; subsetParams.RowsCount = rowCount; - var result = await Driver.SendRequest(QueryExecuteSubsetRequest.Type, subsetParams); + var result = await Driver.SendRequest(SubsetRequest.Type, subsetParams); return result; } diff --git a/docs/samples/jsonrpc/netcore/executequery/jsonrpc.csproj b/docs/samples/jsonrpc/netcore/executequery/jsonrpc.csproj new file mode 100644 index 00000000..07b32243 --- /dev/null +++ b/docs/samples/jsonrpc/netcore/executequery/jsonrpc.csproj @@ -0,0 +1,16 @@ + + + netcoreapp2.1 + Exe + + + + + + + + + + + +