From 9e1c7f64c45722314a1b0407d06dacb12db6b935 Mon Sep 17 00:00:00 2001 From: Stefan Puskarica Date: Mon, 7 Oct 2024 00:05:02 +1100 Subject: [PATCH 1/7] Add new ScriptGeneratorOption for the number of newlines between statements --- .../SqlScriptGeneratorVisitor.StatementList.cs | 5 ++++- .../SqlServer/Settings/SqlScriptGeneratorOptions.xml | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/SqlScriptDom/ScriptDom/SqlServer/ScriptGenerator/SqlScriptGeneratorVisitor.StatementList.cs b/SqlScriptDom/ScriptDom/SqlServer/ScriptGenerator/SqlScriptGeneratorVisitor.StatementList.cs index 1f6945f..6dedb21 100644 --- a/SqlScriptDom/ScriptDom/SqlServer/ScriptGenerator/SqlScriptGeneratorVisitor.StatementList.cs +++ b/SqlScriptDom/ScriptDom/SqlServer/ScriptGenerator/SqlScriptGeneratorVisitor.StatementList.cs @@ -23,7 +23,10 @@ public override void ExplicitVisit(StatementList node) } else { - NewLine(); + for (var i = 0; i < _options.NumNewlinesAfterStatement; i++) + { + NewLine(); + } } GenerateFragmentIfNotNull(statement); diff --git a/SqlScriptDom/ScriptDom/SqlServer/Settings/SqlScriptGeneratorOptions.xml b/SqlScriptDom/ScriptDom/SqlServer/Settings/SqlScriptGeneratorOptions.xml index e81fc47..1706235 100644 --- a/SqlScriptDom/ScriptDom/SqlServer/Settings/SqlScriptGeneratorOptions.xml +++ b/SqlScriptDom/ScriptDom/SqlServer/Settings/SqlScriptGeneratorOptions.xml @@ -28,6 +28,9 @@ IncludeSemiColons_Description Gets or sets a boolean indicating if a semi colon should be included after each statement + + Gets or sets the number of newlines to include after each statement + From 74609ccf6469f025f0201571a18b39b3c40a84c3 Mon Sep 17 00:00:00 2001 From: Stefan Puskarica Date: Sat, 9 Nov 2024 15:37:48 +1100 Subject: [PATCH 2/7] Add test for new generator option --- Test/SqlDom/ScriptGeneratorTests.cs | 44 +++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/Test/SqlDom/ScriptGeneratorTests.cs b/Test/SqlDom/ScriptGeneratorTests.cs index 28e7404..ee21d8b 100644 --- a/Test/SqlDom/ScriptGeneratorTests.cs +++ b/Test/SqlDom/ScriptGeneratorTests.cs @@ -4,6 +4,7 @@ // //------------------------------------------------------------------------------ +using System; using Microsoft.SqlServer.TransactSql.ScriptDom; using Microsoft.VisualStudio.TestTools.UnitTesting; using SqlStudio.Tests.AssemblyTools.TestCategory; @@ -113,5 +114,48 @@ public void TestSqlServerlessScriptGenerator() var scriptGenerator = new SqlServerlessScriptGenerator(options); Assert.AreEqual(SqlVersion.Sql160, scriptGenerator.Options.SqlVersion); } + + [TestMethod] + [Priority(0)] + [SqlStudioTestCategory(Category.UnitTest)] + public void TestNewlinesBetweenStatementsGeneratorOption() { + var tableName = new SchemaObjectName(); + tableName.Identifiers.Add(new Identifier { Value = "TableName" }); + + var tableStatement = new CreateTableStatement + { + SchemaObjectName = tableName + }; + var tableStatementString = "CREATE TABLE TableName;"; + + var statements = new StatementList(); + statements.Statements.Add(tableStatement); + statements.Statements.Add(tableStatement); + + var generatorOptions = new SqlScriptGeneratorOptions { + KeywordCasing = KeywordCasing.Uppercase, + IncludeSemicolons = true, + NumNewlinesAfterStatement = 0 + }; + + var generator = new Sql80ScriptGenerator(generatorOptions); + + generator.GenerateScript(statements, out var sql); + + Assert.AreEqual(tableStatementString + tableStatementString, sql); + + generatorOptions.NumNewlinesAfterStatement = 1; + generator = new Sql80ScriptGenerator(generatorOptions); + + generator.GenerateScript(statements, out sql); + + Assert.AreEqual(tableStatementString + Environment.NewLine + tableStatementString, sql); + + generatorOptions.NumNewlinesAfterStatement = 2; + generator = new Sql80ScriptGenerator(generatorOptions); + + generator.GenerateScript(statements, out sql); + Assert.AreEqual(tableStatementString + Environment.NewLine + Environment.NewLine + tableStatementString, sql); + } } } From 823ca280e09a00d895fc50e80a8d7beb0a34ede2 Mon Sep 17 00:00:00 2001 From: Stefan Puskarica Date: Tue, 12 Nov 2024 19:25:03 +1100 Subject: [PATCH 3/7] Remove space between data type and parameters --- .../ScriptGenerator/SqlScriptGeneratorVisitor.CommonPhrases.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/SqlScriptDom/ScriptDom/SqlServer/ScriptGenerator/SqlScriptGeneratorVisitor.CommonPhrases.cs b/SqlScriptDom/ScriptDom/SqlServer/ScriptGenerator/SqlScriptGeneratorVisitor.CommonPhrases.cs index 48cbbbf..30d5dca 100644 --- a/SqlScriptDom/ScriptDom/SqlServer/ScriptGenerator/SqlScriptGeneratorVisitor.CommonPhrases.cs +++ b/SqlScriptDom/ScriptDom/SqlServer/ScriptGenerator/SqlScriptGeneratorVisitor.CommonPhrases.cs @@ -411,7 +411,6 @@ protected void GenerateParameters(ParameterizedDataTypeReference node) { if (node.Parameters.Count > 0) { - GenerateSpace(); GenerateParenthesisedCommaSeparatedList(node.Parameters); } } From 1390366e2dcbe45c8031bbbf6311943c2b4b9503 Mon Sep 17 00:00:00 2001 From: Stefan Puskarica Date: Sun, 24 Nov 2024 20:11:39 +1100 Subject: [PATCH 4/7] Add new generator options --- .../SqlServer/Settings/SqlScriptGeneratorOptions.xml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/SqlScriptDom/ScriptDom/SqlServer/Settings/SqlScriptGeneratorOptions.xml b/SqlScriptDom/ScriptDom/SqlServer/Settings/SqlScriptGeneratorOptions.xml index e81fc47..0267070 100644 --- a/SqlScriptDom/ScriptDom/SqlServer/Settings/SqlScriptGeneratorOptions.xml +++ b/SqlScriptDom/ScriptDom/SqlServer/Settings/SqlScriptGeneratorOptions.xml @@ -28,6 +28,18 @@ IncludeSemiColons_Description Gets or sets a boolean indicating if a semi colon should be included after each statement + + Gets or sets a boolean indicating if index definitions should have UNIQUE, INCLUDE and WHERE on their own line + + + Gets or sets a boolean indicating if check constraints should have the CHECK part on it's own line + + + Gets or sets a boolean indicating if a space should be included between the data type and the parameters in a data type definition + + + Gets or sets a boolean indicating if a space should be included between parameters in a data type + From 7ace29152cae8ac8908f9b59a92835d09984a3a9 Mon Sep 17 00:00:00 2001 From: Stefan Puskarica Date: Sat, 30 Nov 2024 17:06:12 +1100 Subject: [PATCH 5/7] Add tests --- Test/SqlDom/ScriptGeneratorTests.cs | 177 ++++++++++++++++++++++++++++ 1 file changed, 177 insertions(+) diff --git a/Test/SqlDom/ScriptGeneratorTests.cs b/Test/SqlDom/ScriptGeneratorTests.cs index ee21d8b..9a92ce3 100644 --- a/Test/SqlDom/ScriptGeneratorTests.cs +++ b/Test/SqlDom/ScriptGeneratorTests.cs @@ -5,6 +5,7 @@ //------------------------------------------------------------------------------ using System; +using System.IO; using Microsoft.SqlServer.TransactSql.ScriptDom; using Microsoft.VisualStudio.TestTools.UnitTesting; using SqlStudio.Tests.AssemblyTools.TestCategory; @@ -157,5 +158,181 @@ public void TestNewlinesBetweenStatementsGeneratorOption() { generator.GenerateScript(statements, out sql); Assert.AreEqual(tableStatementString + Environment.NewLine + Environment.NewLine + tableStatementString, sql); } + + [TestMethod] + [Priority(0)] + [SqlStudioTestCategory(Category.UnitTest)] + public void TestNewLineFormattedIndexDefinitionDefault() { + Assert.AreEqual(false, new SqlScriptGeneratorOptions().NewLineFormattedIndexDefinition); + } + + [TestMethod] + [Priority(0)] + [SqlStudioTestCategory(Category.UnitTest)] + public void TestNewlineFormattedCheckConstraintDefault() { + Assert.AreEqual(false, new SqlScriptGeneratorOptions().NewlineFormattedCheckConstraint); + } + + [TestMethod] + [Priority(0)] + [SqlStudioTestCategory(Category.UnitTest)] + public void TestSpaceBetweenDataTypeAndParametersDefault() { + Assert.AreEqual(true, new SqlScriptGeneratorOptions().SpaceBetweenDataTypeAndParameters); + } + + [TestMethod] + [Priority(0)] + [SqlStudioTestCategory(Category.UnitTest)] + public void TestSpaceBetweenParametersInDataTypeDefault() { + Assert.AreEqual(true, new SqlScriptGeneratorOptions().SpaceBetweenParametersInDataType); + } + + [TestMethod] + [Priority(0)] + [SqlStudioTestCategory(Category.UnitTest)] + public void TestSpaceBetweenDataTypeAndParametersWhenFalse() { + var expectedSqlText = @"CREATE TABLE DummyTable ( + ColumnName VARCHAR(50) +);"; + + ParseAndAssertEquality(expectedSqlText, new SqlScriptGeneratorOptions { + SpaceBetweenDataTypeAndParameters = false + }); + } + + [TestMethod] + [Priority(0)] + [SqlStudioTestCategory(Category.UnitTest)] + public void TestSpaceBetweenDataTypeAndParametersWhenTrue() { + var expectedSqlText = @"CREATE TABLE DummyTable ( + ColumnName VARCHAR (50) +);"; + + ParseAndAssertEquality(expectedSqlText, new SqlScriptGeneratorOptions { + SpaceBetweenDataTypeAndParameters = true + }); + } + + [TestMethod] + [Priority(0)] + [SqlStudioTestCategory(Category.UnitTest)] + public void TestSpaceBetweenParametersInDataTypeWhenFalse() { + var expectedSqlText = @"CREATE TABLE DummyTable ( + ColumnName DECIMAL (5,2) +);"; + + ParseAndAssertEquality(expectedSqlText, new SqlScriptGeneratorOptions { + SpaceBetweenParametersInDataType = false + }); + } + + [TestMethod] + [Priority(0)] + [SqlStudioTestCategory(Category.UnitTest)] + public void TestSpaceBetweenParametersInDataTypeWhenTrue() { + var expectedSqlText = @"CREATE TABLE DummyTable ( + ColumnName DECIMAL (5, 2) +);"; + + ParseAndAssertEquality(expectedSqlText, new SqlScriptGeneratorOptions { + SpaceBetweenParametersInDataType = true + }); + } + + [TestMethod] + [Priority(0)] + [SqlStudioTestCategory(Category.UnitTest)] + public void TestNewlineFormattedCheckConstraintWhenFalse() { + var expectedSqlText = @"CREATE TABLE DummyTable ( + CONSTRAINT ComplicatedConstraint CHECK ((Col1 IS NULL + AND (Col2 <> '' + OR Col3 = 0)) + OR (Col1 IS NOT NULL + AND ((Col2 = '' + AND Col3 <> 0) + OR (Col4 IN ('', 'ABC', 'JKL', 'XYZ') + AND Col3 < 0 + AND (Col5 <> '' + OR Col6 <> ''))))) +);"; + + ParseAndAssertEquality(expectedSqlText, new SqlScriptGeneratorOptions { + NewlineFormattedCheckConstraint = false + }); + } + + [TestMethod] + [Priority(0)] + [SqlStudioTestCategory(Category.UnitTest)] + public void TestNewlineFormattedCheckConstraintWhenTrue() { + var expectedSqlText = @"CREATE TABLE DummyTable ( + CONSTRAINT ComplicatedConstraint + CHECK ((Col1 IS NULL + AND (Col2 <> '' + OR Col3 = 0)) + OR (Col1 IS NOT NULL + AND ((Col2 = '' + AND Col3 <> 0) + OR (Col4 IN ('', 'ABC', 'JKL', 'XYZ') + AND Col3 < 0 + AND (Col5 <> '' + OR Col6 <> ''))))) +);"; + + ParseAndAssertEquality(expectedSqlText, new SqlScriptGeneratorOptions { + NewlineFormattedCheckConstraint = true + }); + } + + [TestMethod] + [Priority(0)] + [SqlStudioTestCategory(Category.UnitTest)] + public void TestNewLineFormattedIndexDefinitionWhenFalse() { + var expectedSqlText = @"CREATE TABLE DummyTable ( + INDEX ComplicatedIndex UNIQUE (Col1, Col2, Col3) INCLUDE (Col4, Col5, Col6, Col7, Col8) WHERE Col4 = 'AR' + AND Col3 IN ('ABC', 'XYZ') + AND Col5 = 0 + AND Col6 = 1 + AND Col7 = 0 + AND Col8 IS NOT NULL +);"; + + ParseAndAssertEquality(expectedSqlText, new SqlScriptGeneratorOptions { + NewLineFormattedIndexDefinition = false + }); + } + + [TestMethod] + [Priority(0)] + [SqlStudioTestCategory(Category.UnitTest)] + public void TestNewLineFormattedIndexDefinitionWhenTrue() { + var expectedSqlText = @"CREATE TABLE DummyTable ( + INDEX ComplicatedIndex + UNIQUE (Col1, Col2, Col3) + INCLUDE (Col4, Col5, Col6, Col7, Col8) + WHERE Col4 = 'AR' + AND Col3 IN ('ABC', 'XYZ') + AND Col5 = 0 + AND Col6 = 1 + AND Col7 = 0 + AND Col8 IS NOT NULL +);"; + + ParseAndAssertEquality(expectedSqlText, new SqlScriptGeneratorOptions { + NewLineFormattedIndexDefinition = true + }); + } + + void ParseAndAssertEquality(string sqlText, SqlScriptGeneratorOptions generatorOptions) { + var parser = new TSql160Parser(true); + var fragment = parser.ParseStatementList(new StringReader(sqlText), out var errors); + + Assert.AreEqual(0, errors.Count); + + var generator = new Sql160ScriptGenerator(generatorOptions); + generator.GenerateScript(fragment, out var generatedSqlText); + + Assert.AreEqual(sqlText, generatedSqlText); + } } } From 59033d4b3fa4af48dbddfa86d54deeccf8ed4e34 Mon Sep 17 00:00:00 2001 From: Stefan Puskarica Date: Sat, 30 Nov 2024 17:06:25 +1100 Subject: [PATCH 6/7] implement functionality --- ...lScriptGeneratorVisitor.CheckConstraint.cs | 7 ++- ...SqlScriptGeneratorVisitor.CommonPhrases.cs | 5 ++- .../SqlScriptGeneratorVisitor.Constraints.cs | 4 +- ...lScriptGeneratorVisitor.IndexDefinition.cs | 45 ++++++++++++++++--- .../SqlScriptGeneratorVisitor.Utils.cs | 12 ++--- 5 files changed, 58 insertions(+), 15 deletions(-) diff --git a/SqlScriptDom/ScriptDom/SqlServer/ScriptGenerator/SqlScriptGeneratorVisitor.CheckConstraint.cs b/SqlScriptDom/ScriptDom/SqlServer/ScriptGenerator/SqlScriptGeneratorVisitor.CheckConstraint.cs index b794282..07a7bdd 100644 --- a/SqlScriptDom/ScriptDom/SqlServer/ScriptGenerator/SqlScriptGeneratorVisitor.CheckConstraint.cs +++ b/SqlScriptDom/ScriptDom/SqlServer/ScriptGenerator/SqlScriptGeneratorVisitor.CheckConstraint.cs @@ -15,7 +15,12 @@ public override void ExplicitVisit(CheckConstraintDefinition node) MarkAndPushAlignmentPoint(start); - GenerateConstraintHead(node); + GenerateConstraintHead(node, _options.NewlineFormattedCheckConstraint); + + if (_options.NewlineFormattedCheckConstraint) + { + Indent(); + } GenerateKeyword(TSqlTokenType.Check); diff --git a/SqlScriptDom/ScriptDom/SqlServer/ScriptGenerator/SqlScriptGeneratorVisitor.CommonPhrases.cs b/SqlScriptDom/ScriptDom/SqlServer/ScriptGenerator/SqlScriptGeneratorVisitor.CommonPhrases.cs index 30d5dca..d5f6915 100644 --- a/SqlScriptDom/ScriptDom/SqlServer/ScriptGenerator/SqlScriptGeneratorVisitor.CommonPhrases.cs +++ b/SqlScriptDom/ScriptDom/SqlServer/ScriptGenerator/SqlScriptGeneratorVisitor.CommonPhrases.cs @@ -411,7 +411,10 @@ protected void GenerateParameters(ParameterizedDataTypeReference node) { if (node.Parameters.Count > 0) { - GenerateParenthesisedCommaSeparatedList(node.Parameters); + if (_options.SpaceBetweenDataTypeAndParameters) { + GenerateSpace(); + } + GenerateParenthesisedCommaSeparatedList(node.Parameters, _options.SpaceBetweenParametersInDataType); } } diff --git a/SqlScriptDom/ScriptDom/SqlServer/ScriptGenerator/SqlScriptGeneratorVisitor.Constraints.cs b/SqlScriptDom/ScriptDom/SqlServer/ScriptGenerator/SqlScriptGeneratorVisitor.Constraints.cs index 5f271fa..d331fae 100644 --- a/SqlScriptDom/ScriptDom/SqlServer/ScriptGenerator/SqlScriptGeneratorVisitor.Constraints.cs +++ b/SqlScriptDom/ScriptDom/SqlServer/ScriptGenerator/SqlScriptGeneratorVisitor.Constraints.cs @@ -27,13 +27,13 @@ partial class SqlScriptGeneratorVisitor new KeywordGenerator(TSqlTokenType.Null),}}, }; - protected void GenerateConstraintHead(ConstraintDefinition node) + protected void GenerateConstraintHead(ConstraintDefinition node, bool newline = false) { if (node.ConstraintIdentifier != null) { GenerateKeyword(TSqlTokenType.Constraint); GenerateSpaceAndFragmentIfNotNull(node.ConstraintIdentifier); - GenerateSpace(); + GenerateNewLineOrSpace(newline); } } diff --git a/SqlScriptDom/ScriptDom/SqlServer/ScriptGenerator/SqlScriptGeneratorVisitor.IndexDefinition.cs b/SqlScriptDom/ScriptDom/SqlServer/ScriptGenerator/SqlScriptGeneratorVisitor.IndexDefinition.cs index 38cc30b..14fbf57 100644 --- a/SqlScriptDom/ScriptDom/SqlServer/ScriptGenerator/SqlScriptGeneratorVisitor.IndexDefinition.cs +++ b/SqlScriptDom/ScriptDom/SqlServer/ScriptGenerator/SqlScriptGeneratorVisitor.IndexDefinition.cs @@ -11,6 +11,12 @@ partial class SqlScriptGeneratorVisitor { public override void ExplicitVisit(IndexDefinition node) { + if (_options.NewLineFormattedIndexDefinition) + { + AlignmentPoint start = new AlignmentPoint(); + MarkAndPushAlignmentPoint(start); + } + GenerateKeyword(TSqlTokenType.Index); if (node.Name != null) @@ -20,7 +26,15 @@ public override void ExplicitVisit(IndexDefinition node) if (node.Unique) { - GenerateSpaceAndKeyword(TSqlTokenType.Unique); + if (_options.NewLineFormattedIndexDefinition) + { + NewLineAndIndent(); + } + else + { + GenerateSpace(); + } + GenerateKeyword(TSqlTokenType.Unique); } if (node.IndexType != null) @@ -56,16 +70,32 @@ public override void ExplicitVisit(IndexDefinition node) if (node.IncludeColumns.Count > 0) { - GenerateSpaceAndIdentifier(CodeGenerationSupporter.Include); + if (_options.NewLineFormattedIndexDefinition) + { + NewLineAndIndent(); + } + else + { + GenerateSpace(); + } + GenerateIdentifier(CodeGenerationSupporter.Include); GenerateSpace(); GenerateParenthesisedCommaSeparatedList(node.IncludeColumns); } if (node.FilterPredicate != null) { - GenerateSpaceAndKeyword(TSqlTokenType.Where); - GenerateSpaceAndFragmentIfNotNull(node.FilterPredicate); - } + if (_options.NewLineFormattedIndexDefinition) + { + NewLineAndIndent(); + } + else + { + GenerateSpace(); + } + GenerateKeyword(TSqlTokenType.Where); + GenerateSpaceAndFragmentIfNotNull(node.FilterPredicate); + } if (node.IndexOptions.Count > 0) { @@ -81,6 +111,11 @@ public override void ExplicitVisit(IndexDefinition node) } GenerateFileStreamOn(node); + + if (_options.NewLineFormattedIndexDefinition) + { + PopAlignmentPoint(); + } } } } diff --git a/SqlScriptDom/ScriptDom/SqlServer/ScriptGenerator/SqlScriptGeneratorVisitor.Utils.cs b/SqlScriptDom/ScriptDom/SqlServer/ScriptGenerator/SqlScriptGeneratorVisitor.Utils.cs index ea70ab3..4991713 100644 --- a/SqlScriptDom/ScriptDom/SqlServer/ScriptGenerator/SqlScriptGeneratorVisitor.Utils.cs +++ b/SqlScriptDom/ScriptDom/SqlServer/ScriptGenerator/SqlScriptGeneratorVisitor.Utils.cs @@ -220,7 +220,7 @@ protected void GenerateCommaSeparatedList(IList list, Boolean insertNewLin } // generate a comma-separated list - protected void GenerateCommaSeparatedList(IList list, bool insertNewLine, bool indent) where T : TSqlFragment + protected void GenerateCommaSeparatedList(IList list, bool insertNewLine, bool indent, bool generateSpaces = true) where T : TSqlFragment { GenerateList(list, delegate() { @@ -234,7 +234,7 @@ protected void GenerateCommaSeparatedList(IList list, bool insertNewLine, Indent(); } } - else + else if (generateSpaces) { GenerateSpace(); } @@ -276,18 +276,18 @@ private void GenerateList(IList list, Action gen) where T : TSqlFragment } // generate a parenthsised comma-separated list - protected void GenerateParenthesisedCommaSeparatedList(IList list) where T : TSqlFragment + protected void GenerateParenthesisedCommaSeparatedList(IList list, Boolean generateSpaces = true) where T : TSqlFragment { - GenerateParenthesisedCommaSeparatedList(list, false); + GenerateParenthesisedCommaSeparatedList(list, false, generateSpaces); } // generate a parenthsised comma-separated list - protected void GenerateParenthesisedCommaSeparatedList(IList list, Boolean alwaysGenerateParenthses) where T : TSqlFragment + protected void GenerateParenthesisedCommaSeparatedList(IList list, Boolean alwaysGenerateParenthses, Boolean generateSpaces = true) where T : TSqlFragment { if (list != null && list.Count > 0) { GenerateSymbol(TSqlTokenType.LeftParenthesis); - GenerateCommaSeparatedList(list); + GenerateCommaSeparatedList(list, false, false, generateSpaces); GenerateSymbol(TSqlTokenType.RightParenthesis); } else if (alwaysGenerateParenthses) From 4b9b3db37ea0bde57c6b1c4bf6e7738677e40456 Mon Sep 17 00:00:00 2001 From: Stefan Puskarica Date: Thu, 26 Dec 2024 22:32:56 +1100 Subject: [PATCH 7/7] bug fix --- .../SqlScriptGeneratorVisitor.CommonPhrases.cs | 2 +- .../ScriptGenerator/SqlScriptGeneratorVisitor.Utils.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/SqlScriptDom/ScriptDom/SqlServer/ScriptGenerator/SqlScriptGeneratorVisitor.CommonPhrases.cs b/SqlScriptDom/ScriptDom/SqlServer/ScriptGenerator/SqlScriptGeneratorVisitor.CommonPhrases.cs index d5f6915..f552e22 100644 --- a/SqlScriptDom/ScriptDom/SqlServer/ScriptGenerator/SqlScriptGeneratorVisitor.CommonPhrases.cs +++ b/SqlScriptDom/ScriptDom/SqlServer/ScriptGenerator/SqlScriptGeneratorVisitor.CommonPhrases.cs @@ -414,7 +414,7 @@ protected void GenerateParameters(ParameterizedDataTypeReference node) if (_options.SpaceBetweenDataTypeAndParameters) { GenerateSpace(); } - GenerateParenthesisedCommaSeparatedList(node.Parameters, _options.SpaceBetweenParametersInDataType); + GenerateParenthesisedCommaSeparatedList(node.Parameters, false, _options.SpaceBetweenParametersInDataType); } } diff --git a/SqlScriptDom/ScriptDom/SqlServer/ScriptGenerator/SqlScriptGeneratorVisitor.Utils.cs b/SqlScriptDom/ScriptDom/SqlServer/ScriptGenerator/SqlScriptGeneratorVisitor.Utils.cs index 4991713..f646523 100644 --- a/SqlScriptDom/ScriptDom/SqlServer/ScriptGenerator/SqlScriptGeneratorVisitor.Utils.cs +++ b/SqlScriptDom/ScriptDom/SqlServer/ScriptGenerator/SqlScriptGeneratorVisitor.Utils.cs @@ -276,9 +276,9 @@ private void GenerateList(IList list, Action gen) where T : TSqlFragment } // generate a parenthsised comma-separated list - protected void GenerateParenthesisedCommaSeparatedList(IList list, Boolean generateSpaces = true) where T : TSqlFragment + protected void GenerateParenthesisedCommaSeparatedList(IList list) where T : TSqlFragment { - GenerateParenthesisedCommaSeparatedList(list, false, generateSpaces); + GenerateParenthesisedCommaSeparatedList(list, false); } // generate a parenthsised comma-separated list