Skip to content

Commit

Permalink
Sync Repos: Bringing commits for release 161.9135.0 (#89)
Browse files Browse the repository at this point in the history
* [Security] Update .NET SDK to latest patch version

This change updates to the latest patch version for the .NET SDK which contains the latest security fixes.
Note that your global.json does configure `rollForward`, however roll forward will allow for the build to pass when using a different SDK. So, if locally you have a newer patch version installed it will pass, without the `rollforward` it will fail.

CI in many cases installs exactly what is in the global.json, so making sure that your build requires the latest patch version ensures that CI is compliant with those vulnerabilities.

---

For feedback or questions about this PR, please contact the [Gardener team](mailto:gardener@microsoft.com).

---

This change was automatically generated by [1ES Gardener](https://eng.ms/docs/cloud-ai-platform/devdiv/one-engineering-system-1es/1es-docs/gardener/1es-gardener) (a [MerlinBot](https://aka.ms/MerlinBot) extension) which is an initiative by the 1ES team to help repos stay up-to-date with latest tools, features, and best practices.

* [Security] Update .NET SDK to latest patch version

This change updates to the latest patch version for the .NET SDK which contains the latest security fixes.
Note that your global.json does configure `rollForward`, however roll forward will allow for the build to pass when using a different SDK. So, if locally you have a newer patch version installed it will pass, without the `rollforward` it will fail.

CI in many cases installs exactly what is in the global.json, so making sure that your build requires the latest patch version ensures that CI is compliant with those vulnerabilities.

Release notes:
* [6.0.32](https://github.com/dotnet/core/blob/main/release-notes/6.0/6.0.32/6.0.32.md)

The following CVEs will be addressed by this update:
* [CVE-2024-38081](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-38081)
* [CVE-2024-38095](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-38095)

---

For feedback or questions about this PR, please contact the [Gardener team](mailto:gardener@microsoft.com).

---

This change was automatically generated by [1ES Gardener](https://eng.ms/docs/cloud-ai-platform/devdiv/one-engineering-system-1es/1es-docs/gardener/1es-gardener) (a [MerlinBot](https://aka.ms/MerlinBot) extension) which is an initiative by the 1ES team to help repos stay up-to-date with latest tools, features, and best practices.

* Merged PR 1417651: Add tests for Json data type in scriptdom

This PR adds tests for Json data type in ScriptDom.
##Test added
- ALTER TABLE T ADD jsonCol JSON;
- ALTER TABLE T ALTER COLUMN col JSON;
- Create function with Json data type as parameter;
- Create stored procedure with Json data type as parameter;
- Convert Char to Json;
- Convert NChar to Json;
- Convert Varchar to Json;
- Convert NVarchar to Json;
- Convert Json to Char;
- Convert Json to NChar;
- Convert Json to Varchar;
- Convert Json to NVarchar;
- Cast Char to Json;
- Cast NChar to Json;
- Cast Varchar to Json;
- Cast NVarchar to Json;
- Cast Json to Char;
- Cast Json to NChar;
- Cast Json to Varchar;
- Cast Json to NVarchar;

----
#### AI description  (iteration 1)
#### PR Classification
New feature: Adding tests for JSON data type in ScriptDOM.

#### PR Summary
This pull request introduces tests for the JSON data type in ScriptDOM, ensuring proper handling and conversion of JSON data.
- Added JSON conversion and casting tests in `Test/SqlDom/TestScripts/ExpressionTests160.sql`.
- Created baseline for JSON conversion and casting tests in `Test/SqlDom/Baselines160/ExpressionTests160.sql`.
- Added tests for JSON data type in function and procedure creation in `Test/SqlDom/TestScripts/CreateFunctionStatementTests160.sql` and `Test/SqlDom/TestScripts/CreateProcedureStatementTests160.sql`.
- Included tests for altering tables to add or modify JSON columns in `Test/SqlDom/TestScripts/AlterTableStatementTests160.sql`.
- Updated `Only160SyntaxTests.cs` to include new test scripts for JSON data type.

Related work items: #2949474

* Merged PR 1415210: Adding forceseek to changetable

Adding forceseek to changetable. fixing bug microsoft/DacFx#434

----
#### AI description  (iteration 1)
#### PR Classification
New feature

#### PR Summary
This pull request adds support for the `FORCESEEK` hint in `CHANGETABLE` queries.
- `/SqlScriptDom/Parser/TSql/TSql140.g`, `/SqlScriptDom/Parser/TSql/TSql130.g`, `/SqlScriptDom/Parser/TSql/TSql150.g`, `/SqlScriptDom/Parser/TSql/TSql160.g`: Updated grammar to support `FORCESEEK` in `CHANGETABLE` queries.
- `/SqlScriptDom/Parser/TSql/Ast.xml`: Added `ForceSeek` property to `ChangeTableChangesTableReference` and `ChangeTableVersionTableReference` classes.
- `/SqlScriptDom/ScriptDom/SqlServer/ScriptGenerator/SqlScriptGeneratorVisitor.ChangeTableTableSource.cs`: Implemented code generation for `FORCESEEK` hint.
- `/Test/SqlDom/Baselines150/FromClauseTests150.sql`, `/Test/SqlDom/TestScripts/FromClauseTests150.sql`: Added test cases for `FORCESEEK` in `CHANGETABLE` queries.
- `/Test/SqlDom/Only150SyntaxTests.cs`: Updated test expectations to include new `FORCESEEK` test cases.

* Merged PR 1420062: Added test script for vector native data type

Added test script for expression, ereate table, stored procedure, functions tests with vector native type

----
#### AI description  (iteration 1)
#### PR Classification
New feature: Added test script for vector native data type.

#### PR Summary
This pull request introduces test scripts and updates to support the vector native data type in SQL.
- Added test cases for casting and converting between `vector` and other data types in `/Test/SqlDom/TestScripts/ExpressionTests160.sql` and `/Test/SqlDom/Baselines160/ExpressionTests160.sql`.
- Created stored procedures and functions utilizing the `vector` data type in `/Test/SqlDom/TestScripts/CreateProcedureStatementTests160.sql`, `/Test/SqlDom/Baselines160/CreateProcedureStatementTests160.sql`, `/Test/SqlDom/TestScripts/CreateFunctionStatementTests160.sql`, and `/Test/SqlDom/Baselines160/CreateFunctionStatementTests160.sql`.
- Updated `SqlDataTypeOption` and related parser files to include the `vector` data type in `/SqlScriptDom/Parser/TSql/SqlDataTypeOption.cs`, `/SqlScriptDom/Parser/TSql/TSql80ParserBaseInternal.cs`, `/SqlScriptDom/Parser/TSql/TSql160ParserBaseInternal.cs`, `/SqlScriptDom/Parser/TSql/CodeGenerationSupporter.cs`, and `/SqlScriptDom/ScriptDom/SqlServer/ScriptGenerator/SqlScriptGeneratorVisitor.SqlDataType.cs`.
- Added a new table with a `vector` column in `/Test/SqlDom/TestScripts/CreateTableTests160.sql` and `/Test/SqlDom/Baselines160/CreateTableTests160.sql`.

* Merged PR 1433433: Adding release notes for 161.9135

Adding release notes for 161.9135

----
#### AI description  (iteration 1)
#### PR Classification
Documentation update for release notes.

#### PR Summary
This pull request adds release notes for version 161.9135.0 of `Microsoft.SqlServer.TransactSql.ScriptDom`, detailing new features, fixed issues, and target platform support.
- `release-notes/161.91/161.9135.0.md`: Added release notes including new support for native Vector type and FORCESEEK hint in CHANGETABLE function.

---------

Co-authored-by: MerlinBot <MerlinBot>
Co-authored-by: Lijun Ji <lijji@microsoft.com>
Co-authored-by: Abhishek Kumar (MDD) <Kumar.Abhishek@microsoft.com>
  • Loading branch information
3 people authored Aug 22, 2024
1 parent aa13f7e commit d84cc30
Show file tree
Hide file tree
Showing 27 changed files with 371 additions and 10 deletions.
2 changes: 2 additions & 0 deletions SqlScriptDom/Parser/TSql/Ast.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3552,12 +3552,14 @@
<InheritedClass Name="TableReferenceWithAliasAndColumns" />
<Member Name="Target" Type="SchemaObjectName" Summary="Table on which to obtain tracked changes."/>
<Member Name="SinceVersion" Type="ValueExpression" Summary="Specifies the point from which changes are required."/>
<Member Name="ForceSeek" Type="bool" Summary="Optional parameter that forces a seek operation to be used to access the table_name"/>
</Class>
<Class Name="ChangeTableVersionTableReference" Base="TableReferenceWithAliasAndColumns" Summary="CHANGETABLE clause with VERSION option.">
<InheritedClass Name="TableReferenceWithAliasAndColumns" />
<Member Name="Target" Type="SchemaObjectName" Summary="Table on which to obtain tracked changes."/>
<Member Name="PrimaryKeyColumns" Type="Identifier" Collection="true" Summary="Primary key column names."/>
<Member Name="PrimaryKeyValues" Type="ScalarExpression" Collection="true" Summary="Values for primary key columns."/>
<Member Name="ForceSeek" Type="bool" Summary="Optional parameter that forces a seek operation to be used to access the table_name"/>
</Class>
<Class Name="BooleanTernaryExpression" Base="BooleanExpression" Summary="A boolean expression that has three expressions as children.">
<Member Name="TernaryExpressionType" Type="BooleanTernaryExpressionType" GenerateUpdatePositionInfoCall="false" Summary="The type of the expression."/>
Expand Down
1 change: 1 addition & 0 deletions SqlScriptDom/Parser/TSql/CodeGenerationSupporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1065,6 +1065,7 @@ internal static class CodeGenerationSupporter
internal const string VardecimalStorageFormat = "VARDECIMAL_STORAGE_FORMAT";
internal const string Varp = "VARP";
internal const string VDevNo = "VDEVNO";
internal const string Vector = "Vector";
internal const string Verbose = "VERBOSE";
internal const string VerboseLogging = "VerboseLogging";
internal const string VerifyOnly = "VERIFYONLY";
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 @@ -250,6 +250,11 @@ public enum SqlDataTypeOption
/// </summary>
Json = 34,

/// <summary>
/// Vector data type
/// </summary>
Vector = 35,

#endregion

}
Expand Down
15 changes: 14 additions & 1 deletion SqlScriptDom/Parser/TSql/TSql130.g
Original file line number Diff line number Diff line change
Expand Up @@ -17649,7 +17649,7 @@ changesChangeTableParams [SchemaObjectName vTarget] returns [ChangeTableChangesT
ValueExpression vSinceVersion;
vResult.Target = vTarget;
}
: vSinceVersion = integerOrVariable
: (vSinceVersion = integerOrVariable
{
vResult.SinceVersion = vSinceVersion;
}
Expand All @@ -17658,6 +17658,13 @@ changesChangeTableParams [SchemaObjectName vTarget] returns [ChangeTableChangesT
{
vResult.SinceVersion = vSinceVersion;
}
)
(Comma tHint:Identifier
{
Match(tHint, CodeGenerationSupporter.ForceSeek);
vResult.ForceSeek = true;
}
)?
;

versionChangeTableParams [SchemaObjectName vTarget] returns [ChangeTableVersionTableReference vResult = FragmentFactory.CreateFragment<ChangeTableVersionTableReference>()]
Expand All @@ -17671,6 +17678,12 @@ versionChangeTableParams [SchemaObjectName vTarget] returns [ChangeTableVersionT
{
UpdateTokenInfo(vResult, tRParen);
}
(Comma tHint:Identifier
{
Match(tHint, CodeGenerationSupporter.ForceSeek);
vResult.ForceSeek = true;
}
)?
;

subDmlTableReference [SubDmlFlags subDmlFlags] returns [DataModificationTableReference vResult = FragmentFactory.CreateFragment<DataModificationTableReference>()]
Expand Down
17 changes: 15 additions & 2 deletions SqlScriptDom/Parser/TSql/TSql140.g
Original file line number Diff line number Diff line change
Expand Up @@ -18323,7 +18323,7 @@ changesChangeTableParams [SchemaObjectName vTarget] returns [ChangeTableChangesT
ValueExpression vSinceVersion;
vResult.Target = vTarget;
}
: vSinceVersion = integerOrVariable
: (vSinceVersion = integerOrVariable
{
vResult.SinceVersion = vSinceVersion;
}
Expand All @@ -18332,6 +18332,13 @@ changesChangeTableParams [SchemaObjectName vTarget] returns [ChangeTableChangesT
{
vResult.SinceVersion = vSinceVersion;
}
)
(Comma tHint:Identifier
{
Match(tHint, CodeGenerationSupporter.ForceSeek);
vResult.ForceSeek = true;
}
)?
;

versionChangeTableParams [SchemaObjectName vTarget] returns [ChangeTableVersionTableReference vResult = FragmentFactory.CreateFragment<ChangeTableVersionTableReference>()]
Expand All @@ -18345,8 +18352,14 @@ versionChangeTableParams [SchemaObjectName vTarget] returns [ChangeTableVersionT
{
UpdateTokenInfo(vResult, tRParen);
}
(Comma tHint:Identifier
{
Match(tHint, CodeGenerationSupporter.ForceSeek);
vResult.ForceSeek = true;
}
)?
;

subDmlTableReference [SubDmlFlags subDmlFlags] returns [DataModificationTableReference vResult = FragmentFactory.CreateFragment<DataModificationTableReference>()]
{
DataModificationSpecification vSpec;
Expand Down
15 changes: 14 additions & 1 deletion SqlScriptDom/Parser/TSql/TSql150.g
Original file line number Diff line number Diff line change
Expand Up @@ -19025,7 +19025,7 @@ changesChangeTableParams [SchemaObjectName vTarget] returns [ChangeTableChangesT
ValueExpression vSinceVersion;
vResult.Target = vTarget;
}
: vSinceVersion = integerOrVariable
: (vSinceVersion = integerOrVariable
{
vResult.SinceVersion = vSinceVersion;
}
Expand All @@ -19034,6 +19034,13 @@ changesChangeTableParams [SchemaObjectName vTarget] returns [ChangeTableChangesT
{
vResult.SinceVersion = vSinceVersion;
}
)
(Comma tHint:Identifier
{
Match(tHint, CodeGenerationSupporter.ForceSeek);
vResult.ForceSeek = true;
}
)?
;

versionChangeTableParams [SchemaObjectName vTarget] returns [ChangeTableVersionTableReference vResult = FragmentFactory.CreateFragment<ChangeTableVersionTableReference>()]
Expand All @@ -19047,6 +19054,12 @@ versionChangeTableParams [SchemaObjectName vTarget] returns [ChangeTableVersionT
{
UpdateTokenInfo(vResult, tRParen);
}
(Comma tHint:Identifier
{
Match(tHint, CodeGenerationSupporter.ForceSeek);
vResult.ForceSeek = true;
}
)?
;

subDmlTableReference [SubDmlFlags subDmlFlags] returns [DataModificationTableReference vResult = FragmentFactory.CreateFragment<DataModificationTableReference>()]
Expand Down
15 changes: 14 additions & 1 deletion SqlScriptDom/Parser/TSql/TSql160.g
Original file line number Diff line number Diff line change
Expand Up @@ -19135,7 +19135,7 @@ changesChangeTableParams [SchemaObjectName vTarget] returns [ChangeTableChangesT
ValueExpression vSinceVersion;
vResult.Target = vTarget;
}
: vSinceVersion = integerOrVariable
: (vSinceVersion = integerOrVariable
{
vResult.SinceVersion = vSinceVersion;
}
Expand All @@ -19144,6 +19144,13 @@ changesChangeTableParams [SchemaObjectName vTarget] returns [ChangeTableChangesT
{
vResult.SinceVersion = vSinceVersion;
}
)
(Comma tHint:Identifier
{
Match(tHint, CodeGenerationSupporter.ForceSeek);
vResult.ForceSeek = true;
}
)?
;

versionChangeTableParams [SchemaObjectName vTarget] returns [ChangeTableVersionTableReference vResult = FragmentFactory.CreateFragment<ChangeTableVersionTableReference>()]
Expand All @@ -19157,6 +19164,12 @@ versionChangeTableParams [SchemaObjectName vTarget] returns [ChangeTableVersionT
{
UpdateTokenInfo(vResult, tRParen);
}
(Comma tHint:Identifier
{
Match(tHint, CodeGenerationSupporter.ForceSeek);
vResult.ForceSeek = true;
}
)?
;

subDmlTableReference [SubDmlFlags subDmlFlags] returns [DataModificationTableReference vResult = FragmentFactory.CreateFragment<DataModificationTableReference>()]
Expand Down
2 changes: 2 additions & 0 deletions SqlScriptDom/Parser/TSql/TSql160ParserBaseInternal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ protected static SqlDataTypeOption ParseDataType160(string token)
{
case "JSON":
return SqlDataTypeOption.Json;
case "VECTOR":
return SqlDataTypeOption.Vector;
default:
return ParseDataType100(token);
}
Expand Down
3 changes: 2 additions & 1 deletion SqlScriptDom/Parser/TSql/TSql80ParserBaseInternal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@ internal abstract class TSql80ParserBaseInternal : antlr.LLkParser
SqlDataTypeOption.Char, SqlDataTypeOption.VarChar, SqlDataTypeOption.NChar,
SqlDataTypeOption.NVarChar, SqlDataTypeOption.Decimal, SqlDataTypeOption.Float,
SqlDataTypeOption.Numeric, SqlDataTypeOption.Binary, SqlDataTypeOption.VarBinary,
SqlDataTypeOption.Time, SqlDataTypeOption.DateTime2, SqlDataTypeOption.DateTimeOffset
SqlDataTypeOption.Time, SqlDataTypeOption.DateTime2, SqlDataTypeOption.DateTimeOffset,
SqlDataTypeOption.Vector
};

#region Constructors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ public override void ExplicitVisit(ChangeTableChangesTableReference node)
{
GenerateChangeTablePrefix(node.Target, CodeGenerationSupporter.Changes);
GenerateFragmentIfNotNull(node.SinceVersion);

if (node.ForceSeek)
{
GenerateSymbolAndSpace(TSqlTokenType.Comma);
GenerateIdentifier(CodeGenerationSupporter.ForceSeek);
}
GenerateSymbol(TSqlTokenType.RightParenthesis);
GenerateTableAndColumnAliases(node);
}
Expand All @@ -32,7 +36,11 @@ public override void ExplicitVisit(ChangeTableVersionTableReference node)
GenerateParenthesisedCommaSeparatedList(node.PrimaryKeyColumns);
GenerateSymbolAndSpace(TSqlTokenType.Comma);
GenerateParenthesisedCommaSeparatedList(node.PrimaryKeyValues);

if (node.ForceSeek)
{
GenerateSymbolAndSpace(TSqlTokenType.Comma);
GenerateIdentifier(CodeGenerationSupporter.ForceSeek);
}
GenerateSymbol(TSqlTokenType.RightParenthesis);
GenerateTableAndColumnAliases(node);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ partial class SqlScriptGeneratorVisitor
{ SqlDataTypeOption.DateTimeOffset, new IdentifierGenerator(CodeGenerationSupporter.DateTimeOffset) },
{ SqlDataTypeOption.Rowversion, new IdentifierGenerator(CodeGenerationSupporter.Rowversion) },
{ SqlDataTypeOption.Json, new IdentifierGenerator(CodeGenerationSupporter.Json) },
{ SqlDataTypeOption.Vector, new IdentifierGenerator(CodeGenerationSupporter.Vector) },
};

public override void ExplicitVisit(SqlDataTypeReference node)
Expand Down
32 changes: 32 additions & 0 deletions Test/SqlDom/Baselines150/FromClauseTests150.sql
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,35 @@ FROM (VALUES ('Lorem ipsum'), ('dolor sit amet.')) AS x(col) CROSS APPLY STRING_

SELECT ordinal
FROM (VALUES ('Lorem ipsum'), ('dolor sit amet.')) AS x(col) CROSS APPLY STRING_SPLIT (col, ',', 1);

SELECT *
FROM CHANGETABLE(CHANGES t1, 10, FORCESEEK) AS a;

DELETE t1
FROM CHANGETABLE(CHANGES dbo.t1, @v1, FORCESEEK) AS a(c1);

UPDATE t1
SET c1 = 10
FROM CHANGETABLE(CHANGES d1.dbo.t1, NULL, FORCESEEK) AS a;

SELECT *
FROM CHANGETABLE(VERSION s1.d1.dbo.t1, (c1), (1), FORCESEEK) AS a;

SELECT *
FROM CHANGETABLE(VERSION z..t1, (c1, c2), ('a', 'b'), FORCESEEK) AS a(z1, z2);

SELECT *
FROM CHANGETABLE(CHANGES t1, 10) AS a;

DELETE t1
FROM CHANGETABLE(CHANGES dbo.t1, @v1) AS a(c1);

UPDATE t1
SET c1 = 10
FROM CHANGETABLE(CHANGES d1.dbo.t1, NULL) AS a;

SELECT *
FROM CHANGETABLE(VERSION s1.d1.dbo.t1, (c1), (1)) AS a;

SELECT *
FROM CHANGETABLE(VERSION z..t1, (c1, c2), ('a', 'b')) AS a(z1, z2);
4 changes: 4 additions & 0 deletions Test/SqlDom/Baselines160/AlterTableStatementTests160.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ALTER TABLE T
ADD jsonCol JSON;

ALTER TABLE T ALTER COLUMN col JSON;
19 changes: 19 additions & 0 deletions Test/SqlDom/Baselines160/CreateFunctionStatementTests160.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
CREATE FUNCTION [ParameterizedFunction]
(@parameter_name1 JSON)
RETURNS JSON
AS
BEGIN
RETURN '[30]';
END


GO
CREATE FUNCTION [ParameterizedVectorFunction]
(@parameter_name1 VECTOR (2))
RETURNS VECTOR (2)
AS
BEGIN
DECLARE @v1 AS VECTOR (2);
SET @v1 = CAST (N'[1,1]' AS VECTOR (2));
RETURN @v1;
END
Binary file not shown.
4 changes: 4 additions & 0 deletions Test/SqlDom/Baselines160/CreateTableTests160.sql
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ CREATE TABLE t3 (
)
WITH (XML_COMPRESSION = ON, DATA_COMPRESSION = PAGE);

CREATE TABLE t4 (
c1 VECTOR (10)
);

CREATE TABLE myTable1_HASH_MCD (
id INT NOT NULL,
lastName VARCHAR (20),
Expand Down
55 changes: 55 additions & 0 deletions Test/SqlDom/Baselines160/ExpressionTests160.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
SELECT CONVERT (JSON, CONVERT (CHAR (300), '{}'));

SELECT CONVERT (JSON, CONVERT (NCHAR (300), '{}'));

SELECT CONVERT (JSON, CONVERT (VARCHAR (MAX), '{}'));

SELECT CONVERT (JSON, CONVERT (NVARCHAR (300), '{}'));

SELECT CONVERT (CHAR (300), CONVERT (JSON, '{}'));

SELECT CONVERT (NCHAR (300), CONVERT (JSON, '{}'));

SELECT CONVERT (VARCHAR (300), CONVERT (JSON, '{}'));

SELECT CONVERT (NVARCHAR (MAX), CONVERT (JSON, '{}'));

SELECT CAST (CAST ('{}' AS CHAR (300)) AS JSON);

SELECT CAST (CAST ('{}' AS NCHAR (300)) AS JSON);

SELECT CAST (CAST ('{}' AS VARCHAR (MAX)) AS JSON);

SELECT CAST (CAST ('{}' AS NVARCHAR (300)) AS JSON);

SELECT CAST (CAST ('{}' AS JSON) AS CHAR (300));

SELECT CAST (CAST ('{}' AS JSON) AS NCHAR (300));

SELECT CAST (CAST ('{}' AS JSON) AS VARCHAR (300));

SELECT CAST (CAST ('{}' AS JSON) AS NVARCHAR (MAX));

SELECT CONVERT (VECTOR (2), CONVERT (VARCHAR (MAX), '[1,1]'));

SELECT CONVERT (VECTOR (2), CONVERT (NVARCHAR (MAX), N'[1,1]'));

SELECT CONVERT (VECTOR (2), CONVERT (JSON, '[1,1]'));

SELECT CAST (CAST ('[1,1]' AS VARCHAR (MAX)) AS VECTOR (2));

SELECT CAST (CAST (N'[1,1]' AS NVARCHAR (MAX)) AS VECTOR (2));

SELECT CAST (CAST ('[1,1]' AS JSON) AS VECTOR (2));

SELECT CONVERT (VARCHAR (MAX), CONVERT (VECTOR (3), '[0.1, 0.2, 0.1]'));

SELECT CONVERT (NVARCHAR (MAX), CONVERT (VECTOR (3), '[0.1, 0.2, 0.1]'));

SELECT CONVERT (JSON, CONVERT (VECTOR (3), '[0.1, 0.2, 0.1]'));

SELECT CAST (CAST ('[0.1, 0.1, 0.1]' AS VECTOR (3)) AS VARCHAR (MAX));

SELECT CAST (CAST ('[0.1, 0.1, 0.1]' AS VECTOR (3)) AS NVARCHAR (MAX));

SELECT CAST (CAST ('[0.1, 0.1, 0.1]' AS VECTOR (3)) AS JSON);
2 changes: 1 addition & 1 deletion Test/SqlDom/Only150SyntaxTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ The parser terminates on that batch itself without parsing the rest of the batch
new ParserTest150("CreateExternalLanguage150.sql", 2, 2, 2, 2, 2, 4, 4),
new ParserTest150("AlterExternalLanguage150.sql", 2, 2, 2, 2, 2, 6, 6),
new ParserTest150("DropExternalLanguage150.sql", 2, 2, 2, 2, 2, 2, 2),
new ParserTest150("FromClauseTests150.sql", 2, 2, 0, 0, 0, 0, 0),
new ParserTest150("FromClauseTests150.sql", 12, 12, 5, 5, 5, 0, 0),
new ParserTest150("DeclareTableVariableTests150.sql", 1, 1, 1, 1, 1, 1, 1),
new ParserTest150("MaterializedViewTests150.sql", 6, 3, 3, 3, 3, 0, 0)
};
Expand Down
4 changes: 4 additions & 0 deletions Test/SqlDom/Only160SyntaxTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ public partial class SqlDomTests
// Note: These filenames are case sensitive, make sure they match the checked-in file exactly
private static readonly ParserTest[] Only160TestInfos =
{
new ParserTest160("AlterTableStatementTests160.sql", nErrors80: 0, nErrors90: 0, nErrors100: 0, nErrors110: 0, nErrors120: 0, nErrors130: 0, nErrors140: 0, nErrors150: 0),
new ParserTest160("ExpressionTests160.sql", nErrors80: 1, nErrors90: 0, nErrors100: 0, nErrors110: 0, nErrors120: 0, nErrors130: 0, nErrors140: 0, nErrors150: 0),
new ParserTest160("CreateUserFromExternalProvider160.sql", nErrors80: 2, nErrors90: 1, nErrors100: 1, nErrors110: 1, nErrors120: 1, nErrors130: 1, nErrors140: 1, nErrors150: 1),
new ParserTest160("CreateExternalTableStatementTests160.sql", nErrors80: 2, nErrors90: 2, nErrors100: 2, nErrors110: 2, nErrors120: 2, nErrors130: 2, nErrors140: 2, nErrors150: 2),
new ParserTest160("WindowClauseTests160.sql", nErrors80: 14, nErrors90: 13, nErrors100: 13, nErrors110: 13, nErrors120: 13, nErrors130: 13, nErrors140: 13, nErrors150: 13),
Expand All @@ -25,6 +27,8 @@ public partial class SqlDomTests
new ParserTest160("MergeStatementTests160.sql", nErrors80: 1, nErrors90: 5, nErrors100: 5, nErrors110: 5, nErrors120: 5, nErrors130: 5, nErrors140: 5, nErrors150: 5),
new ParserTest160("SelectStatementTests160.sql", nErrors80: 5, nErrors90: 5, nErrors100: 5, nErrors110: 5, nErrors120: 5, nErrors130: 5, nErrors140: 5, nErrors150: 5),
new ParserTest160("CreateTableTests160.sql", nErrors80: 11, nErrors90: 11, nErrors100: 11, nErrors110: 11, nErrors120: 11, nErrors130: 7, nErrors140: 7, nErrors150: 7),
new ParserTest160("CreateFunctionStatementTests160.sql", nErrors80: 0, nErrors90: 0, nErrors100: 0, nErrors110: 0, nErrors120: 0, nErrors130: 0, nErrors140: 0, nErrors150: 0),
new ParserTest160("CreateProcedureStatementTests160.sql", nErrors80: 0, nErrors90: 0, nErrors100: 0, nErrors110: 0, nErrors120: 0, nErrors130: 0, nErrors140: 0, nErrors150: 0),
new ParserTest160("OpenRowsetStatementTests160.sql", nErrors80: 9, nErrors90: 9, nErrors100: 9, nErrors110: 9, nErrors120: 9, nErrors130: 9, nErrors140: 9, nErrors150: 3),
new ParserTest160("WithinGroupTests160.sql", nErrors80: 2, nErrors90: 2, nErrors100: 2, nErrors110: 2, nErrors120: 2, nErrors130: 0, nErrors140: 0, nErrors150: 0),
// Built-in functions with valid opening and closing parantheses are recognized by default for all parser versions
Expand Down
Loading

0 comments on commit d84cc30

Please sign in to comment.