Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions SqlScriptDom/Parser/TSql/CodeGenerationSupporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -798,6 +798,8 @@ internal static class CodeGenerationSupporter
internal const string RecursiveTriggers = "RECURSIVE_TRIGGERS";
internal const string Recovery = "RECOVERY";
internal const string Regenerate = "REGENERATE";
internal const string RegexpMatches = "REGEXP_MATCHES";
internal const string RegexpSplitToTable = "REGEXP_SPLIT_TO_TABLE";
internal const string RejectType = "REJECT_TYPE";
internal const string RejectSampleValue = "REJECT_SAMPLE_VALUE";
internal const string RejectValue = "REJECT_VALUE";
Expand Down
5 changes: 5 additions & 0 deletions SqlScriptDom/Parser/TSql/EventNotificationEventType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1091,6 +1091,11 @@ public enum EventNotificationEventType
/// </summary>
DropExternalLanguage = 331,

/// <summary>
/// CREATE_VECTOR_INDEX
/// </summary>
CreateVectorIndex = 344,

/// <summary>
/// AUDIT_LOGIN.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion SqlScriptDom/Parser/TSql/TSql170.g
Original file line number Diff line number Diff line change
Expand Up @@ -18966,7 +18966,7 @@ selectTableReferenceElementWithoutJoinParenthesis[SubDmlFlags subDmlFlags] retur
{NextTokenMatches(CodeGenerationSupporter.ChangeTable)}?
vResult=changeTableTableReference
| vResult=builtInFunctionTableReference
| {NextIdentifierMatchesOneOf(new string[] {CodeGenerationSupporter.StringSplit, CodeGenerationSupporter.GenerateSeries})}?
| {NextIdentifierMatchesOneOf(new string[] {CodeGenerationSupporter.StringSplit, CodeGenerationSupporter.GenerateSeries, CodeGenerationSupporter.RegexpMatches, CodeGenerationSupporter.RegexpSplitToTable})}?
vResult=globalFunctionTableReference
| vResult=variableTableReference
| vResult=variableMethodCallTableReference
Expand Down
5 changes: 5 additions & 0 deletions Test/SqlDom/Baselines160/FuzzyStringMatchingTests160.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
SELECT EDIT_DISTANCE('sitting', 'kitten');
SELECT EDIT_DISTANCE('sitting', 'kitten', 2);
SELECT EDIT_DISTANCE_SIMILARITY('hello1', NULL);
SELECT JARO_WINKLER_DISTANCE('', '');
SELECT JARO_WINKLER_SIMILARITY('abcdefghij', 'jihgfedcba');
21 changes: 21 additions & 0 deletions Test/SqlDom/Baselines170/RegexpTVFTests170.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
DECLARE @text AS VARCHAR (100) = 'abcabc';
DECLARE @pattern AS VARCHAR (10) = 'a+';
DECLARE @flags AS CHAR (1) = 'i';

SELECT *
FROM REGEXP_MATCHES ('aaa', 'a');
SELECT *
FROM REGEXP_MATCHES ('hello', 'he(l+)o', 'i');
SELECT *
FROM REGEXP_MATCHES (@text, 'a');
SELECT *
FROM REGEXP_MATCHES (@text, @pattern, @flags);

SELECT *
FROM REGEXP_SPLIT_TO_TABLE ('aaa', 'a');
SELECT *
FROM REGEXP_SPLIT_TO_TABLE ('hello', 'he(l+)o', 'i');
SELECT *
FROM REGEXP_SPLIT_TO_TABLE (@text, 'a');
SELECT *
FROM REGEXP_SPLIT_TO_TABLE (@text, @pattern, @flags);
1 change: 1 addition & 0 deletions Test/SqlDom/Only160SyntaxTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public partial class SqlDomTests
new ParserTest160("TrimFunctionTests160.sql", nErrors80: 7, nErrors90: 7, nErrors100: 7, nErrors110: 7, nErrors120: 7, nErrors130: 7, nErrors140: 4, nErrors150: 4),
new ParserTest160("JsonFunctionTests160.sql", nErrors80: 9, nErrors90: 8, nErrors100: 14, nErrors110: 14, nErrors120: 14, nErrors130: 14, nErrors140: 14, nErrors150: 14),
new ParserTest160(scriptFilename: "IgnoreRespectNullsSyntaxTests160.sql", nErrors80: 12, nErrors90: 8, nErrors100: 8, nErrors110: 8, nErrors120: 8, nErrors130: 8, nErrors140: 8, nErrors150: 8),
new ParserTest160(scriptFilename: "FuzzyStringMatchingTests160.sql", nErrors80: 0, nErrors90: 0, nErrors100: 0, nErrors110: 0, nErrors120: 0, nErrors130: 0, nErrors140: 0, nErrors150: 0),
// OPENROWSET BULK statements specific to SQL Serverless Pools
new ParserTest160(scriptFilename: "OpenRowsetBulkStatementTests160.sql", nErrors80: 8, nErrors90: 8, nErrors100: 8, nErrors110: 8, nErrors120: 8, nErrors130: 8, nErrors140: 8, nErrors150: 8),
new ParserTest160(scriptFilename: "CreateStatisticsStatementTests160.sql", nErrors80: 4, nErrors90: 4, nErrors100: 4, nErrors110: 4, nErrors120: 4, nErrors130: 4, nErrors140: 4, nErrors150: 4),
Expand Down
59 changes: 59 additions & 0 deletions Test/SqlDom/Only170SyntaxTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
using Microsoft.SqlServer.TransactSql.ScriptDom;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using SqlStudio.Tests.AssemblyTools.TestCategory;

namespace SqlStudio.Tests.UTSqlScriptDom
{
public partial class SqlDomTests
{
// Note: These filenames are case sensitive, make sure they match the checked-in file exactly
private static readonly ParserTest[] Only170TestInfos =
{
new ParserTest170("RegexpTVFTests170.sql", nErrors80: 0, nErrors90: 0, nErrors100: 0, nErrors110: 0, nErrors120: 0, nErrors130: 0, nErrors140: 0, nErrors150: 0, nErrors160: 0)
};

private static readonly ParserTest[] SqlAzure170_TestInfos =
{
// Add parser tests that have Azure-specific syntax constructs
// (those that have versioning visitor implemented)
//
};

[TestMethod]
[Priority(0)]
[SqlStudioTestCategory(Category.UnitTest)]
public void TSql170SyntaxIn170ParserTest()
{
// Parsing both for Azure and standalone flavors
//
TSql170Parser parser = new TSql170Parser(true);
SqlScriptGenerator scriptGen = ParserTestUtils.CreateScriptGen(SqlVersion.Sql170);
foreach (ParserTest ti in Only170TestInfos)
{
ParserTest.ParseAndVerify(parser, scriptGen, ti._scriptFilename, ti._result170);
}

// Parsing both for Azure and standalone flavors - explicitly set
// enum value to 'All'
//
parser = new TSql170Parser(true, SqlEngineType.All);
scriptGen = ParserTestUtils.CreateScriptGen(SqlVersion.Sql170);
scriptGen.Options.SqlEngineType = SqlEngineType.All;
foreach (ParserTest ti in Only170TestInfos)
{
ParserTest.ParseAndVerify(parser, scriptGen, ti._scriptFilename, ti._result170);
}

// Explicitly ask for 'standalone' and parse
//
parser = new TSql170Parser(true, SqlEngineType.Standalone);
scriptGen = ParserTestUtils.CreateScriptGen(SqlVersion.Sql170);
scriptGen.Options.SqlEngineType = SqlEngineType.Standalone;
foreach (ParserTest ti in Only170TestInfos)
{
ParserTest.ParseAndVerify(parser, scriptGen, ti._scriptFilename, ti._result170);
}
}

}
}
37 changes: 37 additions & 0 deletions Test/SqlDom/ParserTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,43 @@ public ParserTest160(string scriptFilename, params ParserErrorInfo[] errors80And
{ }
}

internal class ParserTest170 : ParserTest
{
public ParserTest170(string scriptFilename, int nErrors80, int nErrors90, int nErrors100, int nErrors110, int nErrors120, int nErrors130, int nErrors140, int nErrors150, int nErrors160)
: base(
scriptFilename,
new ParserTestOutput(nErrors80), new ParserTestOutput(nErrors90), new ParserTestOutput(nErrors100),
new ParserTestOutput(nErrors110), new ParserTestOutput(nErrors120), new ParserTestOutput(nErrors130),
new ParserTestOutput(nErrors140), new ParserTestOutput(nErrors150), new ParserTestOutput(nErrors160),
new ParserTestOutput("Baselines170"))
{ }

public ParserTest170(string scriptFilename, ParserTestOutput output80, ParserTestOutput output90, ParserTestOutput output100,
ParserTestOutput output110, ParserTestOutput output120, ParserTestOutput output130, ParserTestOutput output140, ParserTestOutput output150, ParserTestOutput output160)
: base(
scriptFilename,
output80, output90, output100,
output110, output120,
output130,
output140,
output150,
output160,
new ParserTestOutput("Baselines170"))
{ }

public ParserTest170(string scriptFilename, params ParserErrorInfo[] errors80And90And100And110And120and130and140and150and160)
: base(
scriptFilename,
new ParserTestOutput(errors80And90And100And110And120and130and140and150and160),
new ParserTestOutput(errors80And90And100And110And120and130and140and150and160),
new ParserTestOutput(errors80And90And100And110And120and130and140and150and160),
new ParserTestOutput(errors80And90And100And110And120and130and140and150and160),
new ParserTestOutput(errors80And90And100And110And120and130and140and150and160),
new ParserTestOutput(errors80And90And100And110And120and130and140and150and160),
new ParserTestOutput("Baselines170"))
{ }
}

internal class ParserTest80And90 : ParserTest
{
public ParserTest80And90(string scriptFilename, int nErrors100)
Expand Down
12 changes: 12 additions & 0 deletions Test/SqlDom/TestScripts/FuzzyStringMatchingTests160.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--EDIT_DISTANCE
SELECT EDIT_DISTANCE('sitting', 'kitten');
SELECT EDIT_DISTANCE('sitting', 'kitten', 2);

--EDIT_DISTANCE_SIMILARITY
SELECT EDIT_DISTANCE_SIMILARITY('hello1', NULL);

--JARO_WINKLER_DISTANCE
SELECT JARO_WINKLER_DISTANCE('', '');

--JARO_WINKLER_SIMILARITY
SELECT JARO_WINKLER_SIMILARITY('abcdefghij', 'jihgfedcba');
21 changes: 21 additions & 0 deletions Test/SqlDom/TestScripts/RegexpTVFTests170.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
DECLARE @text AS VARCHAR (100) = 'abcabc';
DECLARE @pattern AS VARCHAR (10) = 'a+';
DECLARE @flags AS CHAR (1) = 'i';

SELECT *
FROM REGEXP_MATCHES ('aaa', 'a');
SELECT *
FROM REGEXP_MATCHES ('hello', 'he(l+)o', 'i');
SELECT *
FROM REGEXP_MATCHES (@text, 'a');
SELECT *
FROM REGEXP_MATCHES (@text, @pattern, @flags);

SELECT *
FROM REGEXP_SPLIT_TO_TABLE ('aaa', 'a');
SELECT *
FROM REGEXP_SPLIT_TO_TABLE ('hello', 'he(l+)o', 'i');
SELECT *
FROM REGEXP_SPLIT_TO_TABLE (@text, 'a');
SELECT *
FROM REGEXP_SPLIT_TO_TABLE (@text, @pattern, @flags);
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "8.0.404",
"version": "8.0.405",
"rollForward": "latestMajor"
},
"msbuild-sdks": {
Expand Down
25 changes: 25 additions & 0 deletions release-notes/170/170.12.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Release Notes

## Microsoft.SqlServer.TransactSql.ScriptDom 170.12.0
This update brings the below changes over the previous release:

### Target Platform Support

* .NET Framework 4.6.2 (Windows x86, Windows x64)
* .NET 8 (Windows x86, Windows x64, Linux, macOS)

### Dependencies
* Updates.NET SDK to latest patch version 8.0.404

#### .NET Framework
#### .NET Core

### New Features
### Fixed

### Changes
* Removed support for .NET Standard.
* Dropped support for .NET 6
* Added support for .NET 8

### Known Issues
22 changes: 22 additions & 0 deletions release-notes/170/170.15.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Release Notes

## Microsoft.SqlServer.TransactSql.ScriptDom 170.15.0
This update brings the below changes over the previous release:

### Target Platform Support

* .NET Framework 4.6.2 (Windows x86, Windows x64)
* .NET 8 (Windows x86, Windows x64, Linux, macOS)

### Dependencies
* Updates.NET SDK to latest patch version 8.0.404

#### .NET Framework
#### .NET Core

### New Features
### Fixed
* Added support for WAIT_AT_LOW_PRIORITY in CREATE INDEX statement

### Changes
### Known Issues
File renamed without changes.
Loading