diff --git a/SqlScriptDom/Parser/TSql/CodeGenerationSupporter.cs b/SqlScriptDom/Parser/TSql/CodeGenerationSupporter.cs index 918e01c..e3c34b4 100644 --- a/SqlScriptDom/Parser/TSql/CodeGenerationSupporter.cs +++ b/SqlScriptDom/Parser/TSql/CodeGenerationSupporter.cs @@ -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"; diff --git a/SqlScriptDom/Parser/TSql/EventNotificationEventType.cs b/SqlScriptDom/Parser/TSql/EventNotificationEventType.cs index 6fa1406..1339d63 100644 --- a/SqlScriptDom/Parser/TSql/EventNotificationEventType.cs +++ b/SqlScriptDom/Parser/TSql/EventNotificationEventType.cs @@ -1091,6 +1091,11 @@ public enum EventNotificationEventType /// DropExternalLanguage = 331, + /// + /// CREATE_VECTOR_INDEX + /// + CreateVectorIndex = 344, + /// /// AUDIT_LOGIN. /// diff --git a/SqlScriptDom/Parser/TSql/TSql170.g b/SqlScriptDom/Parser/TSql/TSql170.g index b6ba097..cdd6a12 100644 --- a/SqlScriptDom/Parser/TSql/TSql170.g +++ b/SqlScriptDom/Parser/TSql/TSql170.g @@ -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 diff --git a/Test/SqlDom/Baselines160/FuzzyStringMatchingTests160.sql b/Test/SqlDom/Baselines160/FuzzyStringMatchingTests160.sql new file mode 100644 index 0000000..859f523 --- /dev/null +++ b/Test/SqlDom/Baselines160/FuzzyStringMatchingTests160.sql @@ -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'); diff --git a/Test/SqlDom/Baselines170/RegexpTVFTests170.sql b/Test/SqlDom/Baselines170/RegexpTVFTests170.sql new file mode 100644 index 0000000..9c28158 --- /dev/null +++ b/Test/SqlDom/Baselines170/RegexpTVFTests170.sql @@ -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); \ No newline at end of file diff --git a/Test/SqlDom/Only160SyntaxTests.cs b/Test/SqlDom/Only160SyntaxTests.cs index 045425f..53beee6 100644 --- a/Test/SqlDom/Only160SyntaxTests.cs +++ b/Test/SqlDom/Only160SyntaxTests.cs @@ -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), diff --git a/Test/SqlDom/Only170SyntaxTests.cs b/Test/SqlDom/Only170SyntaxTests.cs new file mode 100644 index 0000000..88d968d --- /dev/null +++ b/Test/SqlDom/Only170SyntaxTests.cs @@ -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); + } + } + + } +} \ No newline at end of file diff --git a/Test/SqlDom/ParserTest.cs b/Test/SqlDom/ParserTest.cs index cd432d6..3833faa 100644 --- a/Test/SqlDom/ParserTest.cs +++ b/Test/SqlDom/ParserTest.cs @@ -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) diff --git a/Test/SqlDom/TestScripts/FuzzyStringMatchingTests160.sql b/Test/SqlDom/TestScripts/FuzzyStringMatchingTests160.sql new file mode 100644 index 0000000..b6d416d --- /dev/null +++ b/Test/SqlDom/TestScripts/FuzzyStringMatchingTests160.sql @@ -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'); \ No newline at end of file diff --git a/Test/SqlDom/TestScripts/RegexpTVFTests170.sql b/Test/SqlDom/TestScripts/RegexpTVFTests170.sql new file mode 100644 index 0000000..9c28158 --- /dev/null +++ b/Test/SqlDom/TestScripts/RegexpTVFTests170.sql @@ -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); \ No newline at end of file diff --git a/global.json b/global.json index 63f719f..7d8d343 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "8.0.404", + "version": "8.0.405", "rollForward": "latestMajor" }, "msbuild-sdks": { diff --git a/release-notes/170/170.12.0.md b/release-notes/170/170.12.0.md new file mode 100644 index 0000000..3c65da3 --- /dev/null +++ b/release-notes/170/170.12.0.md @@ -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 diff --git a/release-notes/170/170.15.0.md b/release-notes/170/170.15.0.md new file mode 100644 index 0000000..80d66d2 --- /dev/null +++ b/release-notes/170/170.15.0.md @@ -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 diff --git a/release-notes/170.3/170.3.0.md b/release-notes/170/170.3.0.md similarity index 100% rename from release-notes/170.3/170.3.0.md rename to release-notes/170/170.3.0.md