diff --git a/.build/Signing.props b/.build/Signing.props
index 994ad640..b7a58c3c 100644
--- a/.build/Signing.props
+++ b/.build/Signing.props
@@ -5,7 +5,6 @@
true
true
-
$(EnlistmentRoot)\Externals\VS12\VS10_FinalPublicKey.snk
$(EnlistmentRoot)\Externals\VS12\VS10_FinalPublicKey.snk
External
diff --git a/SqlScriptDom/Parser/TSql/BulkInsertStringOptionHelper.cs b/SqlScriptDom/Parser/TSql/BulkInsertStringOptionHelper.cs
index db6eb2a3..450b7291 100644
--- a/SqlScriptDom/Parser/TSql/BulkInsertStringOptionHelper.cs
+++ b/SqlScriptDom/Parser/TSql/BulkInsertStringOptionHelper.cs
@@ -5,6 +5,8 @@
//------------------------------------------------------------------------------
+using System.Text.RegularExpressions;
+
namespace Microsoft.SqlServer.TransactSql.ScriptDom
{
internal class BulkInsertStringOptionsHelper : OptionsHelper
@@ -30,5 +32,12 @@ private BulkInsertStringOptionsHelper()
}
internal static readonly BulkInsertStringOptionsHelper Instance = new BulkInsertStringOptionsHelper();
+
+ internal static string Trim(Literal option)
+ {
+ // Remove all the whitespaces (tabs, newlines as well)
+ //
+ return Regex.Replace(option.Value.ToUpperInvariant(), @"\s*", "");
+ }
}
}
diff --git a/SqlScriptDom/Parser/TSql/CodeGenerationSupporter.cs b/SqlScriptDom/Parser/TSql/CodeGenerationSupporter.cs
index 468bf506..15ef849e 100644
--- a/SqlScriptDom/Parser/TSql/CodeGenerationSupporter.cs
+++ b/SqlScriptDom/Parser/TSql/CodeGenerationSupporter.cs
@@ -1259,7 +1259,7 @@ internal static class CodeGenerationSupporter
internal const string Russian = "RUSSIAN";
internal const string Romanian = "ROMANIAN";
internal const string Brazilian = "BRAZILIAN";
- internal const string NorwegianBokmal = "NORWEGIAN (BOKM�L)";
+ internal const string NorwegianBokmal = "NORWEGIAN (BOKMÅL)";
internal const string Dutch = "DUTCH";
internal const string Korean = "KOREAN";
internal const string Japanese = "JAPANESE";
diff --git a/SqlScriptDom/Parser/TSql/TSql150.g b/SqlScriptDom/Parser/TSql/TSql150.g
index a359f571..6de1afdf 100644
--- a/SqlScriptDom/Parser/TSql/TSql150.g
+++ b/SqlScriptDom/Parser/TSql/TSql150.g
@@ -6127,6 +6127,7 @@ simpleBulkInsertOptionWithValue returns [LiteralBulkInsertOption vResult = Fragm
{
Literal vValue;
Identifier iValue;
+ StringLiteral jsonOption;
}
: tOption:Identifier EqualsSign
( vValue = integerOrNumeric
@@ -6153,7 +6154,18 @@ simpleBulkInsertOptionWithValue returns [LiteralBulkInsertOption vResult = Fragm
else if (vResult.OptionKind == BulkInsertOptionKind.DataCompression)
MatchString(vValue, CodeGenerationSupporter.Gzip);
else if (vResult.OptionKind == BulkInsertOptionKind.RowsetOptions)
- MatchString(vValue, CodeGenerationSupporter.ReadOptions);
+ {
+ jsonOption = new StringLiteral { Value = BulkInsertStringOptionsHelper.Trim(vValue) };
+
+ if (TryMatch(jsonOption, CodeGenerationSupporter.ReadOptions))
+ {
+ vValue = jsonOption;
+ }
+ else
+ {
+ MatchString(vValue, CodeGenerationSupporter.ReadOptions);
+ }
+ }
vResult.Value = vValue;
}
| iValue = identifier
diff --git a/SqlScriptDom/Parser/TSql/TSql160.g b/SqlScriptDom/Parser/TSql/TSql160.g
index 9222e261..e98ae3c6 100644
--- a/SqlScriptDom/Parser/TSql/TSql160.g
+++ b/SqlScriptDom/Parser/TSql/TSql160.g
@@ -6152,6 +6152,7 @@ simpleBulkInsertOptionWithValue returns [LiteralBulkInsertOption vResult = Fragm
{
Literal vValue;
Identifier iValue;
+ StringLiteral jsonOption;
}
: tOption:Identifier EqualsSign
( vValue = integerOrNumeric
@@ -6178,7 +6179,18 @@ simpleBulkInsertOptionWithValue returns [LiteralBulkInsertOption vResult = Fragm
else if (vResult.OptionKind == BulkInsertOptionKind.DataCompression)
MatchString(vValue, CodeGenerationSupporter.Gzip);
else if (vResult.OptionKind == BulkInsertOptionKind.RowsetOptions)
- MatchString(vValue, CodeGenerationSupporter.ReadOptions);
+ {
+ jsonOption = new StringLiteral { Value = BulkInsertStringOptionsHelper.Trim(vValue) };
+
+ if (TryMatch(jsonOption, CodeGenerationSupporter.ReadOptions))
+ {
+ vValue = jsonOption;
+ }
+ else
+ {
+ MatchString(vValue, CodeGenerationSupporter.ReadOptions);
+ }
+ }
vResult.Value = vValue;
}
| iValue = identifier
@@ -28637,6 +28649,7 @@ inlineIndexColumnDefinition returns [IndexDefinition vResult = FragmentFactory.C
Identifier vIndexIdentifier;
FileGroupOrPartitionScheme vFileGroupOrPartitionScheme;
IndexType vIndexType = null;
+ bool vHasColumnList = false;
BooleanExpression vExpression;
}
:
@@ -28685,8 +28698,14 @@ inlineIndexColumnDefinition returns [IndexDefinition vResult = FragmentFactory.C
tRParen:RightParenthesis
{
UpdateTokenInfo(vResult,tRParen);
+ vHasColumnList=true;
}
)?
+ (
+ {NextTokenMatches(CodeGenerationSupporter.Include)}?
+ tInclude:Identifier
+ identifierColumnList[vResult, vResult.IncludeColumns]
+ )?
(vExpression = filterClause [
vIndexType == null ?
false :
diff --git a/Test/Directory.Build.props b/Test/Directory.Build.props
index d0451430..65891850 100644
--- a/Test/Directory.Build.props
+++ b/Test/Directory.Build.props
@@ -8,12 +8,10 @@
-->
$(MSBuildAllProjects);$(MSBuildThisFileFullPath)
false
-
false
true
-
@@ -29,11 +27,6 @@
$(EnlistmentRoot)\obj\$([MSBuild]::MakeRelative('$(EnlistmentRoot)\', $(MSBuildProjectDirectory)))
-
$(NetfxVersion)
@@ -42,26 +35,13 @@
netcore
netfx
-
-
-
-
-
true
-
-
-
$(OutputPath)\$(TargetFramework)\test.runsettings
-
pdbonly
true
@@ -71,9 +51,4 @@
true
-
-
- false
-
-
\ No newline at end of file
diff --git a/Test/SqlDom/Baselines150/OpenRowsetBulkStatementTests150.sql b/Test/SqlDom/Baselines150/OpenRowsetBulkStatementTests150.sql
index bf75a56c..f65015c8 100644
--- a/Test/SqlDom/Baselines150/OpenRowsetBulkStatementTests150.sql
+++ b/Test/SqlDom/Baselines150/OpenRowsetBulkStatementTests150.sql
@@ -27,3 +27,9 @@ FROM OPENROWSET (BULK 'f1', FORMAT = 'CSV', FIELDTERMINATOR = 'aa', ROWTERMINATO
SELECT *
FROM OPENROWSET (BULK 'f1', FORMAT = 'CSV') WITH ([region] VARCHAR (100) 1, [continent] VARCHAR (100) COLLATE latin1_general_bin2 2, [products] VARCHAR (100) 3, [status] INT 4) AS a;
+
+SELECT *
+FROM OPENROWSET (BULK 'f1', FORMAT = 'CSV', FIELDTERMINATOR = 'aa', ROWTERMINATOR = 'bb', ESCAPECHAR = 'd', FIRSTROW = 1, FIELDQUOTE = 'e', DATA_COMPRESSION = 'gzip', PARSER_VERSION = '1.0', HEADER_ROW = TRUE, DATAFILETYPE = 'widechar', CODEPAGE = 'ACP', ROWSET_OPTIONS = '{"READ_OPTIONS":["ALLOW_INCONSISTENT_READS"]}') WITH ([region] VARCHAR (100)) AS a;
+
+SELECT *
+FROM OPENROWSET (BULK 'f2', FORMAT = 'CSV', FIELDTERMINATOR = 'x', ROWTERMINATOR = 'y', ESCAPECHAR = 'z', FIRSTROW = 1, FIELDQUOTE = 'e', DATA_COMPRESSION = 'gzip', PARSER_VERSION = '2.0', HEADER_ROW = TRUE, DATAFILETYPE = 'widechar', CODEPAGE = 'ACP', ROWSET_OPTIONS = '{"READ_OPTIONS":["ALLOW_INCONSISTENT_READS"]}') WITH ([region] VARCHAR (100)) AS a;
diff --git a/Test/SqlDom/Baselines160/InlineIndexColumnWithINCLUDEtest.sql b/Test/SqlDom/Baselines160/InlineIndexColumnWithINCLUDEtest.sql
new file mode 100644
index 00000000..b345b1ac
--- /dev/null
+++ b/Test/SqlDom/Baselines160/InlineIndexColumnWithINCLUDEtest.sql
@@ -0,0 +1,17 @@
+CREATE TABLE mytable (
+ id BIGINT IDENTITY (1, 1) PRIMARY KEY,
+ col2 VARBINARY (64) NOT NULL,
+ col1 NVARCHAR (256) NOT NULL INDEX ix__mytable__col1__col2 NONCLUSTERED (col1) INCLUDE (col2)
+);
+
+CREATE TABLE mytable (
+ id BIGINT IDENTITY (1, 1) PRIMARY KEY,
+ col2 VARBINARY (64) NOT NULL,
+ col1 NVARCHAR (256) NOT NULL INDEX ix__mytable__col1__col2 NONCLUSTERED (col1)
+);
+
+CREATE TABLE mytable (
+ id BIGINT IDENTITY (1, 1) PRIMARY KEY,
+ col2 VARBINARY (64) NOT NULL,
+ col1 NVARCHAR (256) NOT NULL INDEX ix__mytable__col1__col2 NONCLUSTERED (col1) INCLUDE (col2, id)
+);
\ No newline at end of file
diff --git a/Test/SqlDom/Only150SyntaxTests.cs b/Test/SqlDom/Only150SyntaxTests.cs
index 9e2cb148..65e9b16f 100644
--- a/Test/SqlDom/Only150SyntaxTests.cs
+++ b/Test/SqlDom/Only150SyntaxTests.cs
@@ -25,7 +25,7 @@ public partial class SqlDomTests
new ParserTest150("ScalarUDFInlineTests150.sql", 4, 5, 5, 5, 5, 4, 4),
new ParserTest150("GraphDbSyntaxTests150.sql", 5, 5, 5, 5, 5, 5, 5),
new ParserTest150("BulkInsertStatementTests150.sql", 6, 6, 6, 6, 6, 6, 6),
- new ParserTest150("OpenRowsetBulkStatementTests150.sql", 10, 10, 10, 10, 10, 10, 10),
+ new ParserTest150("OpenRowsetBulkStatementTests150.sql", 12, 12, 12, 12, 12, 12, 12),
/* When a batch is being parsed via a rule and the rule consumes all the tokens it can then it expects
the batch to end with a GO. If there is not a 'GO' then the parser assumes that we have reached EOF.
This is the current parser behavior. So any new addition to the end of the rule will result in parsing errors
diff --git a/Test/SqlDom/Only160SyntaxTests.cs b/Test/SqlDom/Only160SyntaxTests.cs
index 8839ba8d..45e59eac 100644
--- a/Test/SqlDom/Only160SyntaxTests.cs
+++ b/Test/SqlDom/Only160SyntaxTests.cs
@@ -36,7 +36,8 @@ public partial class SqlDomTests
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),
new ParserTest160(scriptFilename: "CreateExternalFileFormatStatementTests160.sql", nErrors80: 2, nErrors90: 2, nErrors100: 2, nErrors110: 2, nErrors120: 2, nErrors130: 1, nErrors140: 1, nErrors150: 1),
- new ParserTest160("StringConcatOperatorTests160.sql", nErrors80: 11, nErrors90: 11, nErrors100: 11, nErrors110: 11, nErrors120: 11, nErrors130: 11, nErrors140: 11, nErrors150: 11)
+ new ParserTest160("StringConcatOperatorTests160.sql", nErrors80: 11, nErrors90: 11, nErrors100: 11, nErrors110: 11, nErrors120: 11, nErrors130: 11, nErrors140: 11, nErrors150: 11),
+ new ParserTest160("InlineIndexColumnWithINCLUDEtest.sql", nErrors80: 3, nErrors90: 3, nErrors100: 3, nErrors110: 3, nErrors120: 2, nErrors130: 2, nErrors140: 2, nErrors150: 2)
};
private static readonly ParserTest[] SqlAzure160_TestInfos =
diff --git a/Test/SqlDom/ParserErrorsTests.cs b/Test/SqlDom/ParserErrorsTests.cs
index a816ef7a..37c2a281 100644
--- a/Test/SqlDom/ParserErrorsTests.cs
+++ b/Test/SqlDom/ParserErrorsTests.cs
@@ -5809,6 +5809,9 @@ public void OpenrowsetSynapseSqlServerlessOptionsNegativeTest()
ParserTestUtils.ErrorTest150("SELECT * FROM OPENROWSET (BULK 'f1', FORMAT = 'CSV') WITH ([region] COLLATE Latin1_General_BIN2) AS a;", new ParserErrorInfo(68, "SQL46010", "COLLATE"));
ParserTestUtils.ErrorTest150("SELECT * FROM OPENROWSET (BULK 'f1', FORMAT = 'PARQUET', PARSER_VERSION = '1.0') AS a;", new ParserErrorInfo(31, "SQL46142"));
ParserTestUtils.ErrorTest150("SELECT * FROM OPENROWSET (BULK 'f1', FORMAT = 'PARQUET', ROWSET_OPTIONS = '{\"READ_OPTIONS\":[\"ALLOW_INCONSISTENT_READS\"]}')) AS a;", new ParserErrorInfo(31, "SQL46142"));
+ ParserTestUtils.ErrorTest150("SELECT * FROM OPENROWSET (BULK 'f1', FORMAT = 'PARQUET', ROWSET_OPTIONS = '')) AS a;", new ParserErrorInfo(74, "SQL46010", "''"));
+ ParserTestUtils.ErrorTest150("SELECT * FROM OPENROWSET (BULK 'f1', FORMAT = 'PARQUET', ROWSET_OPTIONS = 'READ_OPTIONS = ALLOW_INCONSISTENT_READS')) AS a;", new ParserErrorInfo(74, "SQL46010", "'READ_OPTIONS = ALLOW_INCONSISTENT_READS'"));
+ ParserTestUtils.ErrorTest150("SELECT * FROM OPENROWSET (BULK 'f1', FORMAT = 'PARQUET', ROWSET_OPTIONS = '\"READ_OPTIONS\" : allow_INCONSISTENT_READS')) AS x;", new ParserErrorInfo(74, "SQL46010", "'\"READ_OPTIONS\" : allow_INCONSISTENT_READS'"));
}
[TestMethod]
diff --git a/Test/SqlDom/TSqlParserTest.cs b/Test/SqlDom/TSqlParserTest.cs
index f07ce6f6..aa59b521 100644
--- a/Test/SqlDom/TSqlParserTest.cs
+++ b/Test/SqlDom/TSqlParserTest.cs
@@ -481,14 +481,14 @@ public void FieldQuoteParsingIn160ParserTest()
{
TSql160Parser parser = new TSql160Parser(true); IList errors;
- string scriptString = @"create PROC [dbo].[test]� AS
-����������������������������������� BEGIN
-����������������������������������� CREATE TABLE #Test
-����������������������������������� ([Col1] [NVARCHAR](266));
-����������������������������������� COPY INTO #Test
-����������������������������������� FROM 'https://xxxx.blob.core.windows.net/raw/'
-����������������������������������� WITH (FIELDQUOTE='',FIRSTROW = 1)
-����������������������������������� END;";
+ string scriptString = @"create PROC [dbo].[test] AS
+ BEGIN
+ CREATE TABLE #Test
+ ([Col1] [NVARCHAR](266));
+ COPY INTO #Test
+ FROM 'https://xxxx.blob.core.windows.net/raw/'
+ WITH (FIELDQUOTE='',FIRSTROW = 1)
+ END;";
var script = new StringReader(scriptString);
parser.Parse(script, out errors);
diff --git a/Test/SqlDom/TestScripts/InlineIndexColumnWithINCLUDEtest.sql b/Test/SqlDom/TestScripts/InlineIndexColumnWithINCLUDEtest.sql
new file mode 100644
index 00000000..b345b1ac
--- /dev/null
+++ b/Test/SqlDom/TestScripts/InlineIndexColumnWithINCLUDEtest.sql
@@ -0,0 +1,17 @@
+CREATE TABLE mytable (
+ id BIGINT IDENTITY (1, 1) PRIMARY KEY,
+ col2 VARBINARY (64) NOT NULL,
+ col1 NVARCHAR (256) NOT NULL INDEX ix__mytable__col1__col2 NONCLUSTERED (col1) INCLUDE (col2)
+);
+
+CREATE TABLE mytable (
+ id BIGINT IDENTITY (1, 1) PRIMARY KEY,
+ col2 VARBINARY (64) NOT NULL,
+ col1 NVARCHAR (256) NOT NULL INDEX ix__mytable__col1__col2 NONCLUSTERED (col1)
+);
+
+CREATE TABLE mytable (
+ id BIGINT IDENTITY (1, 1) PRIMARY KEY,
+ col2 VARBINARY (64) NOT NULL,
+ col1 NVARCHAR (256) NOT NULL INDEX ix__mytable__col1__col2 NONCLUSTERED (col1) INCLUDE (col2, id)
+);
\ No newline at end of file
diff --git a/Test/SqlDom/TestScripts/OpenRowsetBulkStatementTests150.sql b/Test/SqlDom/TestScripts/OpenRowsetBulkStatementTests150.sql
index e2ae8c03..2669287a 100644
--- a/Test/SqlDom/TestScripts/OpenRowsetBulkStatementTests150.sql
+++ b/Test/SqlDom/TestScripts/OpenRowsetBulkStatementTests150.sql
@@ -7,5 +7,20 @@ select * from openrowset (bulk 'f1', escapechar = '\\', format = 'csV', formatfi
select * from openrowset (bulk 'f1', format = 'PARQUET') as a;
select * from openrowset (bulk 'f1', format = 'DELTA') as a;
select * from openrowset (bulk 'f1', format = 'PARQUET', fieldterminator = 'aa', rowterminator = 'bb', escapechar = 'd', firstrow = 1, fieldquote = 'e', data_compression = 'gzip', header_row = TRUE, datafiletype = 'widechar', codepage = 'ACP') as a;
-select * from openrowset (bulk 'f1', format = 'CSV', fieldterminator = 'aa', rowterminator = 'bb', escapechar = 'd', firstrow = 1, fieldquote = 'e', data_compression = 'gzip', parser_version = '1.0', header_row = TRUE, datafiletype = 'widechar', codepage = 'ACP', rowset_options = '{"READ_OPTIONS":["ALLOW_INCONSISTENT_READS"]}') with ([region] varchar(100)) as a;
-select * from openrowset (bulk 'f1', format = 'CSV') with ([region] varchar(100) 1, [continent] varchar(100) collate latin1_general_bin2 2, [products] varchar(100) 3, [status] int 4) as a;
\ No newline at end of file
+select * from openrowset (bulk 'f1', format = 'CSV', fieldterminator = 'aa', rowterminator = 'bb', escapechar = 'd', firstrow = 1, fieldquote = 'e', data_compression = 'gzip', parser_version = '1.0', header_row = TRUE, datafiletype = 'widechar', codepage = 'ACP', rowset_options = '{ "READ_OPTIONS" :["ALLOW_INCONSISTENT_READS" ] } ') with ([region] varchar(100)) as a;
+select * from openrowset (bulk 'f1', format = 'CSV') with ([region] varchar(100) 1, [continent] varchar(100) collate latin1_general_bin2 2, [products] varchar(100) 3, [status] int 4) as a;
+select * from openrowset (bulk 'f1', format = 'CSV', fieldterminator = 'aa', rowterminator = 'bb', escapechar = 'd', firstrow = 1, fieldquote = 'e', data_compression = 'gzip', parser_version = '1.0', header_row = TRUE, datafiletype = 'widechar', codepage = 'ACP', rowset_options = '
+{
+"READ_OPTIONS"
+:
+[ "ALLOW_INCONSISTENT_READS"]
+
+ }
+') with ([region] varchar(100)) as a;
+select * from openrowset (bulk 'f2', format = 'CSV', fieldterminator = 'x', rowterminator = 'y', escapechar = 'z', firstrow = 1, fieldquote = 'e', data_compression = 'gzip', parser_version = '2.0', header_row = TRUE, datafiletype = 'widechar', codepage = 'ACP', rowset_options = '
+{
+"read_options":
+[ "ALLOW_INCONSISTENT_reads" ]
+
+ }
+') with ([region] varchar(100)) as a;
diff --git a/tools/Directory.Build.props b/tools/Directory.Build.props
index 5ce42e32..ed81b751 100644
--- a/tools/Directory.Build.props
+++ b/tools/Directory.Build.props
@@ -17,9 +17,6 @@
-->
$(MSBuildAllProjects);$(MSBuildThisFileFullPath)
-
- False
-
False