mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-16 09:35:36 -05:00
Edit Data: Better errors for possible truncation (#514)
* Fix to make sql exceptions surface properly to user (with important notes!) * Adding support for detecting column size issues when updating a cell * Adding unit tests for the exception on read scenario
This commit is contained in:
committed by
Karl Burtram
parent
9499d73cec
commit
e9bc97e290
@@ -204,7 +204,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.QueryExecution.Execution
|
||||
// If:
|
||||
// ... I request to execute a valid query with all batches as no op
|
||||
var workspaceService = GetDefaultWorkspaceService(string.Format("{0}\r\nGO\r\n{0}", Common.NoOpQuery));
|
||||
var queryService = Common.GetPrimedExecutionService(null, true, false, workspaceService);
|
||||
var queryService = Common.GetPrimedExecutionService(null, true, false, false, workspaceService);
|
||||
var queryParams = new ExecuteDocumentSelectionParams { QuerySelection = Common.WholeDocument, OwnerUri = Constants.OwnerUri };
|
||||
|
||||
var efv = new EventFlowValidator<ExecuteRequestResult>()
|
||||
@@ -239,7 +239,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.QueryExecution.Execution
|
||||
// If:
|
||||
// ... I request to execute a valid query with no results
|
||||
var workspaceService = GetDefaultWorkspaceService(Constants.StandardQuery);
|
||||
var queryService = Common.GetPrimedExecutionService(null, true, false, workspaceService);
|
||||
var queryService = Common.GetPrimedExecutionService(null, true, false, false, workspaceService);
|
||||
var queryParams = new ExecuteDocumentSelectionParams { QuerySelection = Common.WholeDocument, OwnerUri = Constants.OwnerUri};
|
||||
|
||||
var efv = new EventFlowValidator<ExecuteRequestResult>()
|
||||
@@ -266,8 +266,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.QueryExecution.Execution
|
||||
// If:
|
||||
// ... I request to execute a valid query with results
|
||||
var workspaceService = GetDefaultWorkspaceService(Constants.StandardQuery);
|
||||
var queryService = Common.GetPrimedExecutionService(Common.StandardTestDataSet, true, false,
|
||||
workspaceService);
|
||||
var queryService = Common.GetPrimedExecutionService(Common.StandardTestDataSet, true, false, false, workspaceService);
|
||||
var queryParams = new ExecuteDocumentSelectionParams { OwnerUri = Constants.OwnerUri, QuerySelection = Common.WholeDocument};
|
||||
|
||||
var efv = new EventFlowValidator<ExecuteRequestResult>()
|
||||
@@ -295,7 +294,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.QueryExecution.Execution
|
||||
// ... I request to execute a valid query with one batch and multiple result sets
|
||||
var workspaceService = GetDefaultWorkspaceService(Constants.StandardQuery);
|
||||
var dataset = new[] {Common.StandardTestResultSet, Common.StandardTestResultSet};
|
||||
var queryService = Common.GetPrimedExecutionService(dataset, true, false, workspaceService);
|
||||
var queryService = Common.GetPrimedExecutionService(dataset, true, false, false, workspaceService);
|
||||
var queryParams = new ExecuteDocumentSelectionParams { OwnerUri = Constants.OwnerUri, QuerySelection = Common.WholeDocument};
|
||||
|
||||
var efv = new EventFlowValidator<ExecuteRequestResult>()
|
||||
@@ -322,7 +321,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.QueryExecution.Execution
|
||||
// If:
|
||||
// ... I request a to execute a valid query with multiple batches
|
||||
var workspaceService = GetDefaultWorkspaceService(string.Format("{0}\r\nGO\r\n{0}", Constants.StandardQuery));
|
||||
var queryService = Common.GetPrimedExecutionService(Common.StandardTestDataSet, true, false, workspaceService);
|
||||
var queryService = Common.GetPrimedExecutionService(Common.StandardTestDataSet, true, false, false, workspaceService);
|
||||
var queryParams = new ExecuteDocumentSelectionParams { OwnerUri = Constants.OwnerUri, QuerySelection = Common.WholeDocument};
|
||||
|
||||
var efv = new EventFlowValidator<ExecuteRequestResult>()
|
||||
@@ -354,7 +353,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.QueryExecution.Execution
|
||||
// If:
|
||||
// ... I request to execute a query using a file URI that isn't connected
|
||||
var workspaceService = GetDefaultWorkspaceService(Constants.StandardQuery);
|
||||
var queryService = Common.GetPrimedExecutionService(null, false, false, workspaceService);
|
||||
var queryService = Common.GetPrimedExecutionService(null, false, false, false, workspaceService);
|
||||
var queryParams = new ExecuteDocumentSelectionParams { OwnerUri = "notConnected", QuerySelection = Common.WholeDocument };
|
||||
|
||||
var efv = new EventFlowValidator<ExecuteRequestResult>()
|
||||
@@ -376,7 +375,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.QueryExecution.Execution
|
||||
// If:
|
||||
// ... I request to execute a query
|
||||
var workspaceService = GetDefaultWorkspaceService(Constants.StandardQuery);
|
||||
var queryService = Common.GetPrimedExecutionService(null, true, false, workspaceService);
|
||||
var queryService = Common.GetPrimedExecutionService(null, true, false, false, workspaceService);
|
||||
var queryParams = new ExecuteDocumentSelectionParams { OwnerUri = Constants.OwnerUri, QuerySelection = Common.WholeDocument};
|
||||
|
||||
// Note, we don't care about the results of the first request
|
||||
@@ -404,7 +403,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.QueryExecution.Execution
|
||||
// If:
|
||||
// ... I request to execute a query
|
||||
var workspaceService = GetDefaultWorkspaceService(Constants.StandardQuery);
|
||||
var queryService = Common.GetPrimedExecutionService(null, true, false, workspaceService);
|
||||
var queryService = Common.GetPrimedExecutionService(null, true, false, false, workspaceService);
|
||||
var queryParams = new ExecuteDocumentSelectionParams { OwnerUri = Constants.OwnerUri, QuerySelection = Common.WholeDocument};
|
||||
|
||||
// Note, we don't care about the results of the first request
|
||||
@@ -435,7 +434,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.QueryExecution.Execution
|
||||
// If:
|
||||
// ... I request to execute a query that is invalid
|
||||
var workspaceService = GetDefaultWorkspaceService(Constants.StandardQuery);
|
||||
var queryService = Common.GetPrimedExecutionService(null, true, true, workspaceService);
|
||||
var queryService = Common.GetPrimedExecutionService(null, true, true, false, workspaceService);
|
||||
var queryParams = new ExecuteDocumentSelectionParams {OwnerUri = Constants.OwnerUri, QuerySelection = Common.WholeDocument};
|
||||
|
||||
var efv = new EventFlowValidator<ExecuteRequestResult>()
|
||||
@@ -458,7 +457,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.QueryExecution.Execution
|
||||
// [Fact]
|
||||
public async Task SimpleExecuteErrorWithNoResultsTest()
|
||||
{
|
||||
var queryService = Common.GetPrimedExecutionService(null, true, false, null);
|
||||
var queryService = Common.GetPrimedExecutionService(null, true, false, false, null);
|
||||
var queryParams = new SimpleExecuteParams { OwnerUri = Constants.OwnerUri, QueryString = Constants.StandardQuery };
|
||||
var efv = new EventFlowValidator<SimpleExecuteResult>()
|
||||
.AddSimpleExecuteErrorValidator(SR.QueryServiceResultSetHasNoResults)
|
||||
@@ -480,7 +479,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.QueryExecution.Execution
|
||||
[Fact]
|
||||
public async Task SimpleExecuteVerifyResultsTest()
|
||||
{
|
||||
var queryService = Common.GetPrimedExecutionService(Common.StandardTestDataSet, true, false, null);
|
||||
var queryService = Common.GetPrimedExecutionService(Common.StandardTestDataSet, true, false, false, null);
|
||||
var queryParams = new SimpleExecuteParams { OwnerUri = Constants.OwnerUri, QueryString = Constants.StandardQuery };
|
||||
var efv = new EventFlowValidator<SimpleExecuteResult>()
|
||||
.AddSimpleExecuteQueryResultValidator(Common.StandardTestDataSet)
|
||||
@@ -504,7 +503,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.QueryExecution.Execution
|
||||
[Fact]
|
||||
public async Task SimpleExecuteMultipleQueriesTest()
|
||||
{
|
||||
var queryService = Common.GetPrimedExecutionService(Common.StandardTestDataSet, true, false, null);
|
||||
var queryService = Common.GetPrimedExecutionService(Common.StandardTestDataSet, true, false, false, null);
|
||||
var queryParams = new SimpleExecuteParams { OwnerUri = Constants.OwnerUri, QueryString = Constants.StandardQuery };
|
||||
var efv1 = new EventFlowValidator<SimpleExecuteResult>()
|
||||
.AddSimpleExecuteQueryResultValidator(Common.StandardTestDataSet)
|
||||
|
||||
Reference in New Issue
Block a user