Visitar URL original
Merge commits for release 161.8834.0 (#44) · codezerg/SqlScriptDOM@9f71e00 · GitHub
Skip to content

Commit 9f71e00

Browse files
authored
Merge commits for release 161.8834.0 (microsoft#44)
* Merged PR 1047593: Added PARSER_VERSION format option to the grammar This option is [only available on SQL Serverless Pools](https://learn.microsoft.com/en-us/sql/t-sql/statements/create-external-file-format-transact-sql?view=aps-pdw-2016-au7&tabs=delimited#format_options). I've tested the option by adding parser error tests. Related work items: #2368725 * Merged PR 1054529: Multiple Column Distribution Support in ScriptDom for Dw SqlView Multiple Column Distribution Support in ScriptDom for Dw SqlView 1. Added DistributionColumns member with Collection="true" attribute in ViewHashDistributionPolicy class in AST.xml 2. CollectionFirstItem="true" attribute added in DistributionColumn member of ViewHashDistributionPolicy class in AST.xml 3. ViewHashDistributionPolicy updated with multiple columns(AddAndUpdateTokenInfo) in TSql130.g,TSql140.g,TSql150.g and TSql160.g 4. SqlScriptGeneratorVisitor.ViewHashDistributionPolicy is modified with DistributionColumns 5. Modified CreateMaterializedViewNegativeTest method in ParserErrorsTests.cs DISTRIBUTION = HASH(Col3, Col4,, Col5)) 6. Added create Materialized View scripts with MCD in following scripts files a. MaterializedViewTests*.sql in Baselines* and TestScripts folder. Related work items: #2391658 * Merged PR 1067388: Update build tools Use antlr from antlr2.org Use powershell instead of Sed for generating props Fixes microsoft#26 * Add additional asserts in test case for CursorOption
1 parent ed5ecbe commit 9f71e00

30 files changed

Lines changed: 335 additions & 63 deletions

‎Directory.Build.props‎

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,28 @@
4949

5050
<!-- put obj files in a mirror tree off the root to keep the src folder tree cleaner -->
5151
<BaseIntermediateOutputPath Condition=" '$(BaseIntermediateOutputPath)' == '' ">$(EnlistmentRoot)\obj\$([MSBuild]::MakeRelative('$(EnlistmentRoot)\', $(MSBuildProjectDirectory)))</BaseIntermediateOutputPath>
52-
52+
5353
<AntlrSourceUrl>https://www.antlr2.org/download/antlr-2.7.5.exe</AntlrSourceUrl>
5454
<AntlrLocation>$(BaseIntermediateOutputPath)\antlr-2.7.5.exe</AntlrLocation>
5555
</PropertyGroup>
5656

57+
<!-- Don't enable localization when we are inside VS -->
58+
<PropertyGroup Condition="'$(BuildingInsideVisualStudio)'=='true'">
59+
<EnableLocalization>false</EnableLocalization>
60+
</PropertyGroup>
61+
62+
<!-- Localization is not enabled by default. Pass /p:EnableLocalization=true to override that.
63+
For some details, see: https://ceapex.visualstudio.com/CEINTL/_wiki/wikis/CEINTL.wiki/341/Localization-in-MSBuild-Retail
64+
-->
65+
<PropertyGroup>
66+
<EnableLocalization Condition="'$(EnableLocalization)' == ''">false</EnableLocalization>
67+
<PostBuildLocalization>$(EnableLocalization)</PostBuildLocalization>
68+
<!-- This corresponds to the APEX13 languages: Tier1 + CSY/TRK/PLK
69+
For language sets details, see: https://ceapex.visualstudio.com/CEINTL/_git/SoftwareLocalization?path=%2Fsrc%2FOneBranchPackages%2FLocalization.Languages%2FLocalization.Languages.props&_a=contents&version=GBmain
70+
-->
71+
<LanguageSet Condition="'$(EnableLocalization)' == 'true'">VS_Main_Languages</LanguageSet>
72+
</PropertyGroup>
73+
5774
<PropertyGroup>
5875
<NoWarn>1591</NoWarn>
5976
</PropertyGroup>

‎SqlScriptDom/Parser/TSql/Ast.xml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@
107107
</Class>
108108
<Class Name="ViewHashDistributionPolicy" Base="ViewDistributionPolicy" Summary="Representation of the HASH option for a materialized view distribution policy.">
109109
<InheritedClass Name="ViewDistributionPolicy"/>
110-
<Member Name="DistributionColumn" Type="Identifier" GenerateUpdatePositionInfoCall="false" Summary="The column reference in the HASH option for a view distribution policy."/>
110+
<Member Name="DistributionColumn" Type="Identifier" CollectionFirstItem="true" GenerateUpdatePositionInfoCall="false" Summary="The column reference in the HASH option for a view distribution policy."/>
111+
<Member Name="DistributionColumns" Type="Identifier" Collection="true" GenerateUpdatePositionInfoCall="false" Summary="The columns reference in the HASH option for a view distribution policy."/>
111112
</Class>
112113
<Class Name="TriggerObject" Summary="Information on what trigger is being created/altered" >
113114
<Member Name="Name" Type="SchemaObjectName" Summary="The object to create the trigger on."/>

‎SqlScriptDom/Parser/TSql/ExternalFileFormatOptionHelper.cs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ private ExternalFileFormatOptionHelper()
2323
AddOptionMapping(ExternalFileFormatOptionKind.DataCompression, CodeGenerationSupporter.DataCompression);
2424
AddOptionMapping(ExternalFileFormatOptionKind.FirstRow, CodeGenerationSupporter.FirstRow2);
2525
AddOptionMapping(ExternalFileFormatOptionKind.Encoding, CodeGenerationSupporter.Encoding);
26+
AddOptionMapping(ExternalFileFormatOptionKind.ParserVersion, CodeGenerationSupporter.ParserVersion);
2627
}
2728

2829
internal static readonly ExternalFileFormatOptionHelper Instance = new ExternalFileFormatOptionHelper();

‎SqlScriptDom/Parser/TSql/ExternalFileFormatOptionKind.cs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ public enum ExternalFileFormatOptionKind
2121
UseTypeDefault = 5,
2222
DataCompression = 6,
2323
FirstRow = 7,
24-
Encoding = 8
24+
Encoding = 8,
25+
ParserVersion = 9
2526
}
2627

2728
#pragma warning restore 1591

‎SqlScriptDom/Parser/TSql/TSql100.g‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11984,7 +11984,6 @@ cursorOption returns [CursorOption vResult = FragmentFactory.CreateFragment<Curs
1198411984
: tOption:Identifier
1198511985
{
1198611986
vResult.OptionKind=CursorOptionsHelper.Instance.ParseOption(tOption);
11987-
UpdateTokenInfo(vResult, tOption);
1198811987
}
1198911988
;
1199011989

‎SqlScriptDom/Parser/TSql/TSql110.g‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13994,7 +13994,6 @@ cursorOption returns [CursorOption vResult = FragmentFactory.CreateFragment<Curs
1399413994
: tOption:Identifier
1399513995
{
1399613996
vResult.OptionKind=CursorOptionsHelper.Instance.ParseOption(tOption);
13997-
UpdateTokenInfo(vResult, tOption);
1399813997
}
1399913998
;
1400013999

‎SqlScriptDom/Parser/TSql/TSql120.g‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14396,7 +14396,6 @@ cursorOption returns [CursorOption vResult = FragmentFactory.CreateFragment<Curs
1439614396
: tOption:Identifier
1439714397
{
1439814398
vResult.OptionKind=CursorOptionsHelper.Instance.ParseOption(tOption);
14399-
UpdateTokenInfo(vResult, tOption);
1440014399
}
1440114400
;
1440214401

‎SqlScriptDom/Parser/TSql/TSql130.g‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15640,7 +15640,6 @@ cursorOption returns [CursorOption vResult = FragmentFactory.CreateFragment<Curs
1564015640
: tOption:Identifier
1564115641
{
1564215642
vResult.OptionKind=CursorOptionsHelper.Instance.ParseOption(tOption);
15643-
UpdateTokenInfo(vResult, tOption);
1564415643
}
1564515644
;
1564615645

@@ -23118,12 +23117,20 @@ viewHashDistributionPolicy returns [ViewHashDistributionPolicy vResult = Fragmen
2311823117
Identifier vIdentifier;
2311923118
}
2312023119
:
23121-
tHash:Identifier LeftParenthesis vIdentifier = identifier
23120+
tHash:Identifier
2312223121
{
2312323122
Match(tHash, CodeGenerationSupporter.Hash);
23124-
vResult.DistributionColumn = vIdentifier;
2312523123
UpdateTokenInfo(vResult, tHash);
2312623124
}
23125+
LeftParenthesis vIdentifier = identifier
23126+
{
23127+
AddAndUpdateTokenInfo(vResult, vResult.DistributionColumns, vIdentifier);
23128+
}
23129+
(Comma vIdentifier = identifier
23130+
{
23131+
AddAndUpdateTokenInfo(vResult, vResult.DistributionColumns, vIdentifier);
23132+
}
23133+
)*
2312723134
tRParen:RightParenthesis
2312823135
{
2312923136
UpdateTokenInfo(vResult, tRParen);

‎SqlScriptDom/Parser/TSql/TSql140.g‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16025,7 +16025,6 @@ cursorOption returns [CursorOption vResult = FragmentFactory.CreateFragment<Curs
1602516025
: tOption:Identifier
1602616026
{
1602716027
vResult.OptionKind=CursorOptionsHelper.Instance.ParseOption(tOption);
16028-
UpdateTokenInfo(vResult, tOption);
1602916028
}
1603016029
;
1603116030

@@ -23687,12 +23686,20 @@ viewHashDistributionPolicy returns [ViewHashDistributionPolicy vResult = Fragmen
2368723686
Identifier vIdentifier;
2368823687
}
2368923688
:
23690-
tHash:Identifier LeftParenthesis vIdentifier = identifier
23689+
tHash:Identifier
2369123690
{
2369223691
Match(tHash, CodeGenerationSupporter.Hash);
23693-
vResult.DistributionColumn = vIdentifier;
2369423692
UpdateTokenInfo(vResult, tHash);
2369523693
}
23694+
LeftParenthesis vIdentifier = identifier
23695+
{
23696+
AddAndUpdateTokenInfo(vResult, vResult.DistributionColumns, vIdentifier);
23697+
}
23698+
(Comma vIdentifier = identifier
23699+
{
23700+
AddAndUpdateTokenInfo(vResult, vResult.DistributionColumns, vIdentifier);
23701+
}
23702+
)*
2369623703
tRParen:RightParenthesis
2369723704
{
2369823705
UpdateTokenInfo(vResult, tRParen);

‎SqlScriptDom/Parser/TSql/TSql150.g‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16695,7 +16695,6 @@ cursorOption returns [CursorOption vResult = FragmentFactory.CreateFragment<Curs
1669516695
: tOption:Identifier
1669616696
{
1669716697
vResult.OptionKind=CursorOptionsHelper.Instance.ParseOption(tOption);
16698-
UpdateTokenInfo(vResult, tOption);
1669916698
}
1670016699
;
1670116700

@@ -24433,12 +24432,20 @@ viewHashDistributionPolicy returns [ViewHashDistributionPolicy vResult = Fragmen
2443324432
Identifier vIdentifier;
2443424433
}
2443524434
:
24436-
tHash:Identifier LeftParenthesis vIdentifier = identifier
24435+
tHash:Identifier
2443724436
{
2443824437
Match(tHash, CodeGenerationSupporter.Hash);
24439-
vResult.DistributionColumn = vIdentifier;
2444024438
UpdateTokenInfo(vResult, tHash);
2444124439
}
24440+
LeftParenthesis vIdentifier = identifier
24441+
{
24442+
AddAndUpdateTokenInfo(vResult, vResult.DistributionColumns, vIdentifier);
24443+
}
24444+
(Comma vIdentifier = identifier
24445+
{
24446+
AddAndUpdateTokenInfo(vResult, vResult.DistributionColumns, vIdentifier);
24447+
}
24448+
)*
2444224449
tRParen:RightParenthesis
2444324450
{
2444424451
UpdateTokenInfo(vResult, tRParen);

0 commit comments

Comments
 (0)