mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-16 01:25:41 -05:00
Support GO N syntax to execute multiple times (#551)
* Support `GO N` syntax to execute multiple times - Plumbed through the batch execution count from the parser and used in the batch execution code path - Functionality matches SSMS: - Outputs loop start/end messages that match SSMS if you're doing multi-batch execution - Outputs an "ignoring failure" error if an error happens during a batch - Added tests for this - Manually verified end to end also * Fixing test error
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Microsoft.SqlTools.ServiceLayer.BatchParser;
|
||||
using System;
|
||||
using Microsoft.SqlTools.ServiceLayer.BatchParser;
|
||||
using Microsoft.SqlTools.ServiceLayer.BatchParser.ExecutionEngineCode;
|
||||
using Xunit;
|
||||
|
||||
@@ -20,6 +21,20 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.BatchParser
|
||||
Assert.Equal(1, batch.StartColumn);
|
||||
Assert.Equal(2, batch.EndLine);
|
||||
Assert.Equal(sqlScript.Length+1, batch.EndColumn);
|
||||
Assert.Equal(1, batch.BatchExecutionCount);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CheckSQLBatchStatementWithRepeatExecution()
|
||||
{
|
||||
using (BatchParserWrapper parserWrapper = new BatchParserWrapper())
|
||||
{
|
||||
string sqlScript = "select * from sys.object" + Environment.NewLine + "GO 2";
|
||||
var batches = parserWrapper.GetBatches(sqlScript);
|
||||
Assert.Equal(1, batches.Count);
|
||||
BatchDefinition batch = batches[0];
|
||||
Assert.Equal(2, batch.BatchExecutionCount);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user