Skip to content
Closed
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
3 changes: 3 additions & 0 deletions SqlScriptDom/Parser/TSql/TSql100.g
Original file line number Diff line number Diff line change
Expand Up @@ -15503,10 +15503,13 @@ xmlForClause returns [XmlForClause vResult = FragmentFactory.CreateFragment<XmlF
{
XmlForClauseOption vOption;
XmlForClauseOptions encountered = XmlForClauseOptions.None;
int forTokenIndex = GetLastTokenIndex(); // Store the index of the FOR token before matching the next token
}
: tXml:Identifier vOption = xmlForClauseMode
{
Match(tXml, CodeGenerationSupporter.Xml);
// Explicitly set the FirstTokenIndex to the FOR token
UpdateTokenInfo(vResult, forTokenIndex, forTokenIndex);
AddAndUpdateTokenInfo(vResult, vResult.Options, vOption);
}
(Comma vOption = xmlParam[encountered]
Expand Down
3 changes: 3 additions & 0 deletions SqlScriptDom/Parser/TSql/TSql110.g
Original file line number Diff line number Diff line change
Expand Up @@ -17718,10 +17718,13 @@ xmlForClause returns [XmlForClause vResult = FragmentFactory.CreateFragment<XmlF
{
XmlForClauseOption vOption;
XmlForClauseOptions encountered = XmlForClauseOptions.None;
int forTokenIndex = GetLastTokenIndex(); // Store the index of the FOR token before matching the next token
}
: tXml:Identifier vOption = xmlForClauseMode
{
Match(tXml, CodeGenerationSupporter.Xml);
// Explicitly set the FirstTokenIndex to the FOR token
UpdateTokenInfo(vResult, forTokenIndex, forTokenIndex);
AddAndUpdateTokenInfo(vResult, vResult.Options, vOption);
}
(Comma vOption = xmlParam[encountered]
Expand Down
3 changes: 3 additions & 0 deletions SqlScriptDom/Parser/TSql/TSql120.g
Original file line number Diff line number Diff line change
Expand Up @@ -18221,10 +18221,13 @@ xmlForClause returns [XmlForClause vResult = FragmentFactory.CreateFragment<XmlF
{
XmlForClauseOption vOption;
XmlForClauseOptions encountered = XmlForClauseOptions.None;
int forTokenIndex = GetLastTokenIndex(); // Store the index of the FOR token before matching the next token
}
: tXml:Identifier vOption = xmlForClauseMode
{
Match(tXml, CodeGenerationSupporter.Xml);
// Explicitly set the FirstTokenIndex to the FOR token
UpdateTokenInfo(vResult, forTokenIndex, forTokenIndex);
AddAndUpdateTokenInfo(vResult, vResult.Options, vOption);
}
(Comma vOption = xmlParam[encountered]
Expand Down
6 changes: 6 additions & 0 deletions SqlScriptDom/Parser/TSql/TSql130.g
Original file line number Diff line number Diff line change
Expand Up @@ -19957,10 +19957,13 @@ xmlForClause returns [XmlForClause vResult = FragmentFactory.CreateFragment<XmlF
{
XmlForClauseOption vOption;
XmlForClauseOptions encountered = XmlForClauseOptions.None;
int forTokenIndex = GetLastTokenIndex(); // Store the index of the FOR token before matching the next token
}
: tXml:Identifier vOption = xmlForClauseMode
{
Match(tXml, CodeGenerationSupporter.Xml);
// Explicitly set the FirstTokenIndex to the FOR token
UpdateTokenInfo(vResult, forTokenIndex, forTokenIndex);
AddAndUpdateTokenInfo(vResult, vResult.Options, vOption);
}
(Comma vOption = xmlParam[encountered]
Expand Down Expand Up @@ -20047,10 +20050,13 @@ jsonForClause returns [JsonForClause vResult = FragmentFactory.CreateFragment<Js
{
JsonForClauseOption vOption;
JsonForClauseOptions encountered = JsonForClauseOptions.None;
int forTokenIndex = GetLastTokenIndex(); // Store the index of the FOR token before matching the next token
}
: tJson:Identifier vOption = jsonForClauseMode
{
Match(tJson, CodeGenerationSupporter.Json);
// Explicitly set the FirstTokenIndex to the FOR token
UpdateTokenInfo(vResult, forTokenIndex, forTokenIndex);
AddAndUpdateTokenInfo(vResult, vResult.Options, vOption);
}
(Comma vOption = jsonParam[encountered]
Expand Down
6 changes: 6 additions & 0 deletions SqlScriptDom/Parser/TSql/TSql140.g
Original file line number Diff line number Diff line change
Expand Up @@ -20546,10 +20546,13 @@ xmlForClause returns [XmlForClause vResult = FragmentFactory.CreateFragment<XmlF
{
XmlForClauseOption vOption;
XmlForClauseOptions encountered = XmlForClauseOptions.None;
int forTokenIndex = GetLastTokenIndex(); // Store the index of the FOR token before matching the next token
}
: tXml:Identifier vOption = xmlForClauseMode
{
Match(tXml, CodeGenerationSupporter.Xml);
// Explicitly set the FirstTokenIndex to the FOR token
UpdateTokenInfo(vResult, forTokenIndex, forTokenIndex);
AddAndUpdateTokenInfo(vResult, vResult.Options, vOption);
}
(Comma vOption = xmlParam[encountered]
Expand Down Expand Up @@ -20636,10 +20639,13 @@ jsonForClause returns [JsonForClause vResult = FragmentFactory.CreateFragment<Js
{
JsonForClauseOption vOption;
JsonForClauseOptions encountered = JsonForClauseOptions.None;
int forTokenIndex = GetLastTokenIndex(); // Store the index of the FOR token before matching the next token
}
: tJson:Identifier vOption = jsonForClauseMode
{
Match(tJson, CodeGenerationSupporter.Json);
// Explicitly set the FirstTokenIndex to the FOR token
UpdateTokenInfo(vResult, forTokenIndex, forTokenIndex);
AddAndUpdateTokenInfo(vResult, vResult.Options, vOption);
}
(Comma vOption = jsonParam[encountered]
Expand Down
6 changes: 6 additions & 0 deletions SqlScriptDom/Parser/TSql/TSql150.g
Original file line number Diff line number Diff line change
Expand Up @@ -21296,10 +21296,13 @@ xmlForClause returns [XmlForClause vResult = FragmentFactory.CreateFragment<XmlF
{
XmlForClauseOption vOption;
XmlForClauseOptions encountered = XmlForClauseOptions.None;
int forTokenIndex = GetLastTokenIndex(); // Store the index of the FOR token before matching the next token
}
: tXml:Identifier vOption = xmlForClauseMode
{
Match(tXml, CodeGenerationSupporter.Xml);
// Explicitly set the FirstTokenIndex to the FOR token
UpdateTokenInfo(vResult, forTokenIndex, forTokenIndex);
AddAndUpdateTokenInfo(vResult, vResult.Options, vOption);
}
(Comma vOption = xmlParam[encountered]
Expand Down Expand Up @@ -21386,10 +21389,13 @@ jsonForClause returns [JsonForClause vResult = FragmentFactory.CreateFragment<Js
{
JsonForClauseOption vOption;
JsonForClauseOptions encountered = JsonForClauseOptions.None;
int forTokenIndex = GetLastTokenIndex(); // Store the index of the FOR token before matching the next token
}
: tJson:Identifier vOption = jsonForClauseMode
{
Match(tJson, CodeGenerationSupporter.Json);
// Explicitly set the FirstTokenIndex to the FOR token
UpdateTokenInfo(vResult, forTokenIndex, forTokenIndex);
AddAndUpdateTokenInfo(vResult, vResult.Options, vOption);
}
(Comma vOption = jsonParam[encountered]
Expand Down
6 changes: 6 additions & 0 deletions SqlScriptDom/Parser/TSql/TSql160.g
Original file line number Diff line number Diff line change
Expand Up @@ -21520,10 +21520,13 @@ xmlForClause returns [XmlForClause vResult = FragmentFactory.CreateFragment<XmlF
{
XmlForClauseOption vOption;
XmlForClauseOptions encountered = XmlForClauseOptions.None;
int forTokenIndex = GetLastTokenIndex(); // Store the index of the FOR token before matching the next token
}
: tXml:Identifier vOption = xmlForClauseMode
{
Match(tXml, CodeGenerationSupporter.Xml);
// Explicitly set the FirstTokenIndex to the FOR token
UpdateTokenInfo(vResult, forTokenIndex, forTokenIndex);
AddAndUpdateTokenInfo(vResult, vResult.Options, vOption);
}
(Comma vOption = xmlParam[encountered]
Expand Down Expand Up @@ -21610,10 +21613,13 @@ jsonForClause returns [JsonForClause vResult = FragmentFactory.CreateFragment<Js
{
JsonForClauseOption vOption;
JsonForClauseOptions encountered = JsonForClauseOptions.None;
int forTokenIndex = GetLastTokenIndex(); // Store the index of the FOR token before matching the next token
}
: tJson:Identifier vOption = jsonForClauseMode
{
Match(tJson, CodeGenerationSupporter.Json);
// Explicitly set the FirstTokenIndex to the FOR token
UpdateTokenInfo(vResult, forTokenIndex, forTokenIndex);
AddAndUpdateTokenInfo(vResult, vResult.Options, vOption);
}
(Comma vOption = jsonParam[encountered]
Expand Down
6 changes: 6 additions & 0 deletions SqlScriptDom/Parser/TSql/TSql170.g
Original file line number Diff line number Diff line change
Expand Up @@ -21520,10 +21520,13 @@ xmlForClause returns [XmlForClause vResult = FragmentFactory.CreateFragment<XmlF
{
XmlForClauseOption vOption;
XmlForClauseOptions encountered = XmlForClauseOptions.None;
int forTokenIndex = GetLastTokenIndex(); // Store the index of the FOR token before matching the next token
}
: tXml:Identifier vOption = xmlForClauseMode
{
Match(tXml, CodeGenerationSupporter.Xml);
// Explicitly set the FirstTokenIndex to the FOR token
UpdateTokenInfo(vResult, forTokenIndex, forTokenIndex);
AddAndUpdateTokenInfo(vResult, vResult.Options, vOption);
}
(Comma vOption = xmlParam[encountered]
Expand Down Expand Up @@ -21610,10 +21613,13 @@ jsonForClause returns [JsonForClause vResult = FragmentFactory.CreateFragment<Js
{
JsonForClauseOption vOption;
JsonForClauseOptions encountered = JsonForClauseOptions.None;
int forTokenIndex = GetLastTokenIndex(); // Store the index of the FOR token before matching the next token
}
: tJson:Identifier vOption = jsonForClauseMode
{
Match(tJson, CodeGenerationSupporter.Json);
// Explicitly set the FirstTokenIndex to the FOR token
UpdateTokenInfo(vResult, forTokenIndex, forTokenIndex);
AddAndUpdateTokenInfo(vResult, vResult.Options, vOption);
}
(Comma vOption = jsonParam[encountered]
Expand Down
3 changes: 3 additions & 0 deletions SqlScriptDom/Parser/TSql/TSql80.g
Original file line number Diff line number Diff line change
Expand Up @@ -6167,10 +6167,13 @@ xmlForClause returns [XmlForClause vResult = FragmentFactory.CreateFragment<XmlF
{
XmlForClauseOption vOption;
XmlForClauseOptions encountered = XmlForClauseOptions.None;
int forTokenIndex = GetLastTokenIndex(); // Store the index of the FOR token before matching the next token
}
: tXml:Identifier vOption = xmlForClauseMode
{
Match(tXml, CodeGenerationSupporter.Xml);
// Explicitly set the FirstTokenIndex to the FOR token
UpdateTokenInfo(vResult, forTokenIndex, forTokenIndex);
AddAndUpdateTokenInfo(vResult, vResult.Options, vOption);
}
(Comma vOption = xmlParam[encountered]
Expand Down
3 changes: 3 additions & 0 deletions SqlScriptDom/Parser/TSql/TSql90.g
Original file line number Diff line number Diff line change
Expand Up @@ -12572,10 +12572,13 @@ xmlForClause returns [XmlForClause vResult = FragmentFactory.CreateFragment<XmlF
{
XmlForClauseOption vOption;
XmlForClauseOptions encountered = XmlForClauseOptions.None;
int forTokenIndex = GetLastTokenIndex(); // Store the index of the FOR token before matching the next token
}
: tXml:Identifier vOption = xmlForClauseMode
{
Match(tXml, CodeGenerationSupporter.Xml);
// Explicitly set the FirstTokenIndex to the FOR token
UpdateTokenInfo(vResult, forTokenIndex, forTokenIndex);
AddAndUpdateTokenInfo(vResult, vResult.Options, vOption);
}
(Comma vOption = xmlParam[encountered]
Expand Down
17 changes: 17 additions & 0 deletions Test/SqlDom/TestScripts/ForClauseInSubqueryTests.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
-- FOR XML in subquery tests
SELECT *
FROM dbo.foo
FOR XML PATH(''), ROOT ('x'), TYPE;

SET @x = (SELECT *
FROM dbo.foo
FOR XML PATH(''), ROOT ('x'), TYPE);

-- FOR JSON in subquery tests
SELECT *
FROM dbo.foo
FOR JSON PATH, ROOT ('x');

SET @x = (SELECT *
FROM dbo.foo
FOR JSON PATH, ROOT ('x'));
Loading