Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync Repos: porting commits for release 161.91.09 #77

Merged
merged 3 commits into from
Mar 15, 2024
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: 1 addition & 1 deletion SqlScriptDom/Parser/TSql/Ast.xml
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@
</Class>
<Class Name="ParameterlessCall" Base="PrimaryExpression" Summary="Represents calls without the parenthesis and parameters.">
<InheritedClass Name="PrimaryExpression" />
<Member Name="ParameterlessCallType" Type="ParameterlessCallType" GenerateUpdatePositionInfoCall="false" Summary="An enum that can be User, CurrentUser, SessionUser, SystemUser or CurrentTimestamp."/>
<Member Name="ParameterlessCallType" Type="ParameterlessCallType" GenerateUpdatePositionInfoCall="false" Summary="An enum that can be User, CurrentUser, SessionUser, SystemUser, CurrentTimestamp or CurrentDate."/>
</Class>
<Class Name="ScalarSubquery" Base="PrimaryExpression" Summary="Represents the subquery.">
<InheritedClass Name="PrimaryExpression" />
Expand Down
6 changes: 5 additions & 1 deletion SqlScriptDom/Parser/TSql/ParameterlessCallType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ public enum ParameterlessCallType
/// <summary>
/// The CURRENT_TIMESTAMP keyword was used.
/// </summary>
CurrentTimestamp = 4
CurrentTimestamp = 4,
/// <summary>
/// The CURRENT_DATE keyword was used.
/// </summary>
CurrentDate = 5
}

#pragma warning restore 1591
Expand Down
5 changes: 5 additions & 0 deletions SqlScriptDom/Parser/TSql/SqlDataTypeOption.cs
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,11 @@ public enum SqlDataTypeOption
/// </summary>
Rowversion = 33,

/// <summary>
/// JSON data type
/// </summary>
Json = 34,

#endregion

}
Expand Down
6 changes: 6 additions & 0 deletions SqlScriptDom/Parser/TSql/TSql100.g
Original file line number Diff line number Diff line change
Expand Up @@ -20772,6 +20772,12 @@ parameterlessCall returns [ParameterlessCall vResult = this.FragmentFactory.Crea
UpdateTokenInfo(vResult,tCurrentTimestamp);
vResult.ParameterlessCallType = ParameterlessCallType.CurrentTimestamp;
}
|
tCurrentDate:CurrentDate
{
UpdateTokenInfo(vResult,tCurrentDate);
vResult.ParameterlessCallType = ParameterlessCallType.CurrentDate;
}
;

expressionList [TSqlFragment vParent, IList<ScalarExpression> expressions]
Expand Down
6 changes: 6 additions & 0 deletions SqlScriptDom/Parser/TSql/TSql110.g
Original file line number Diff line number Diff line change
Expand Up @@ -23628,6 +23628,12 @@ parameterlessCall returns [ParameterlessCall vResult = this.FragmentFactory.Crea
UpdateTokenInfo(vResult,tCurrentTimestamp);
vResult.ParameterlessCallType = ParameterlessCallType.CurrentTimestamp;
}
|
tCurrentDate:CurrentDate
{
UpdateTokenInfo(vResult,tCurrentDate);
vResult.ParameterlessCallType = ParameterlessCallType.CurrentDate;
}
;

expressionList [TSqlFragment vParent, IList<ScalarExpression> expressions]
Expand Down
6 changes: 6 additions & 0 deletions SqlScriptDom/Parser/TSql/TSql120.g
Original file line number Diff line number Diff line change
Expand Up @@ -24377,6 +24377,12 @@ parameterlessCall returns [ParameterlessCall vResult = this.FragmentFactory.Crea
UpdateTokenInfo(vResult,tCurrentTimestamp);
vResult.ParameterlessCallType = ParameterlessCallType.CurrentTimestamp;
}
|
tCurrentDate:CurrentDate
{
UpdateTokenInfo(vResult,tCurrentDate);
vResult.ParameterlessCallType = ParameterlessCallType.CurrentDate;
}
;

expressionList [TSqlFragment vParent, IList<ScalarExpression> expressions]
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 @@ -29188,6 +29188,12 @@ parameterlessCall returns [ParameterlessCall vResult = this.FragmentFactory.Crea
UpdateTokenInfo(vResult,tCurrentTimestamp);
vResult.ParameterlessCallType = ParameterlessCallType.CurrentTimestamp;
}
|
tCurrentDate:CurrentDate
{
UpdateTokenInfo(vResult,tCurrentDate);
vResult.ParameterlessCallType = ParameterlessCallType.CurrentDate;
}
;

expressionList [TSqlFragment vParent, IList<ScalarExpression> expressions]
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 @@ -29975,6 +29975,12 @@ parameterlessCall returns [ParameterlessCall vResult = this.FragmentFactory.Crea
UpdateTokenInfo(vResult,tCurrentTimestamp);
vResult.ParameterlessCallType = ParameterlessCallType.CurrentTimestamp;
}
|
tCurrentDate:CurrentDate
{
UpdateTokenInfo(vResult,tCurrentDate);
vResult.ParameterlessCallType = ParameterlessCallType.CurrentDate;
}
;

expressionList [TSqlFragment vParent, IList<ScalarExpression> expressions]
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 @@ -31121,6 +31121,12 @@ parameterlessCall returns [ParameterlessCall vResult = this.FragmentFactory.Crea
UpdateTokenInfo(vResult,tCurrentTimestamp);
vResult.ParameterlessCallType = ParameterlessCallType.CurrentTimestamp;
}
|
tCurrentDate:CurrentDate
{
UpdateTokenInfo(vResult,tCurrentDate);
vResult.ParameterlessCallType = ParameterlessCallType.CurrentDate;
}
;

expressionList [TSqlFragment vParent, IList<ScalarExpression> expressions]
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 @@ -31707,6 +31707,12 @@ parameterlessCall returns [ParameterlessCall vResult = this.FragmentFactory.Crea
UpdateTokenInfo(vResult,tCurrentTimestamp);
vResult.ParameterlessCallType = ParameterlessCallType.CurrentTimestamp;
}
|
tCurrentDate:CurrentDate
{
UpdateTokenInfo(vResult,tCurrentDate);
vResult.ParameterlessCallType = ParameterlessCallType.CurrentDate;
}
;

expressionList [TSqlFragment vParent, IList<ScalarExpression> expressions]
Expand Down
6 changes: 6 additions & 0 deletions SqlScriptDom/Parser/TSql/TSql80.g
Original file line number Diff line number Diff line change
Expand Up @@ -9062,6 +9062,12 @@ parameterlessCall returns [ParameterlessCall vResult = this.FragmentFactory.Crea
UpdateTokenInfo(vResult,tCurrentTimestamp);
vResult.ParameterlessCallType = ParameterlessCallType.CurrentTimestamp;
}
|
tCurrentDate:CurrentDate
{
UpdateTokenInfo(vResult,tCurrentDate);
vResult.ParameterlessCallType = ParameterlessCallType.CurrentDate;
}
;

identifierBuiltInFunctionCall returns [FunctionCall vResult = FragmentFactory.CreateFragment<FunctionCall>()]
Expand Down
6 changes: 6 additions & 0 deletions SqlScriptDom/Parser/TSql/TSql90.g
Original file line number Diff line number Diff line change
Expand Up @@ -16466,6 +16466,12 @@ parameterlessCall returns [ParameterlessCall vResult = this.FragmentFactory.Crea
UpdateTokenInfo(vResult,tCurrentTimestamp);
vResult.ParameterlessCallType = ParameterlessCallType.CurrentTimestamp;
}
|
tCurrentDate:CurrentDate
{
UpdateTokenInfo(vResult,tCurrentDate);
vResult.ParameterlessCallType = ParameterlessCallType.CurrentDate;
}
;

overClause returns [OverClause vResult]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ partial class SqlScriptGeneratorVisitor
{ParameterlessCallType.SessionUser, new KeywordGenerator(TSqlTokenType.SessionUser)},
{ParameterlessCallType.SystemUser, new KeywordGenerator(TSqlTokenType.SystemUser)},
{ParameterlessCallType.User, new KeywordGenerator(TSqlTokenType.User)},
{ParameterlessCallType.CurrentDate, new KeywordGenerator(TSqlTokenType.CurrentDate)},
};

public override void ExplicitVisit(ParameterlessCall node)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ partial class SqlScriptGeneratorVisitor
{ SqlDataTypeOption.DateTime2, new IdentifierGenerator(CodeGenerationSupporter.DateTime2) },
{ SqlDataTypeOption.DateTimeOffset, new IdentifierGenerator(CodeGenerationSupporter.DateTimeOffset) },
{ SqlDataTypeOption.Rowversion, new IdentifierGenerator(CodeGenerationSupporter.Rowversion) },
{ SqlDataTypeOption.Json, new IdentifierGenerator(CodeGenerationSupporter.Json) },
};

public override void ExplicitVisit(SqlDataTypeReference node)
Expand Down
3 changes: 2 additions & 1 deletion Test/SqlDom/BaselinesCommon/ExpressionTests.sql
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ SELECT USER,
CURRENT_USER,
SESSION_USER,
SYSTEM_USER,
CURRENT_TIMESTAMP;
CURRENT_TIMESTAMP,
CURRENT_DATE;

SELECT USER COLLATE SQL_Latin1_General_CP1_CI_AS,
CURRENT_USER;
Expand Down
2 changes: 1 addition & 1 deletion Test/SqlDom/TestScripts/ExpressionTests.sql
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ SELECT CONVERT(decimal(10,5), CONVERT(varbinary(20), @myval))
select convert(datetime, @date, 101)

-- test parameterless calls
select user, current_user, session_user, system_user, current_timestamp
select user, current_user, session_user, system_user, current_timestamp, current_date
select user collate SQL_Latin1_General_CP1_CI_AS, current_user

-- test UniqueRowFilterCall
Expand Down
28 changes: 28 additions & 0 deletions release-notes/161.91/161.9109.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Release Notes

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

### Target Platform Support

* .NET Framework 4.6.2 (Windows x86, Windows x64)
* .NET 6 (Windows x86, Windows x64, Linux, macOS)
* .NET Standard 2.0+ (Windows x86, Windows x64, Linux, macOS)

### Dependencies

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

### New Features
* Adds support for CURRENT_DATE keyword.
* Adds support for native JSON type.
### Fixed
* Fixes parsing OPENROWSET with numeric codepage as string.
* Adding quotes around invalid keyword in error messages.

### Changes
* Adds a static method to create a parser.

### Known Issues
Loading