Skip to content

Commit

Permalink
GitHub Issue #55: OUTPUT args to proc declaration without parens
Browse files Browse the repository at this point in the history
  • Loading branch information
TaoK committed Sep 2, 2012
1 parent 065dea2 commit c87bc88
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
4 changes: 4 additions & 0 deletions PoorMansTSqlFormatterLib/Parsers/TSqlStandardParser.cs
Expand Up @@ -540,6 +540,10 @@ public XmlDocument ParseSQL(ITokenList tokenList)
isSprocArgument = true; isSprocArgument = true;
} }


//Also proc definitions - argument lists without parens
if (sqlTree.PathNameMatches(0, SqlXmlConstants.ENAME_DDL_PROCEDURAL_BLOCK))
isSprocArgument = true;

if (!isSprocArgument) if (!isSprocArgument)
{ {
sqlTree.EscapeMergeAction(); sqlTree.EscapeMergeAction();
Expand Down
8 changes: 7 additions & 1 deletion PoorMansTSqlFormatterTest/Data/InputSql/05_ComplexDDL.txt
Expand Up @@ -334,5 +334,11 @@ GO




EXECUTE sp_MS_marksystemobject 'sp_ScriptTable' EXECUTE sp_MS_marksystemobject 'sp_ScriptTable'
go

CREATE PROCEDURE AnotherTest
@FirstValue Int,
@TestValue BIT = 0 OUTPUT
AS
SELECT 0



9 changes: 8 additions & 1 deletion PoorMansTSqlFormatterTest/Data/ParsedSql/05_ComplexDDL.txt
Expand Up @@ -334,5 +334,12 @@ Modifications:




</WhiteSpace><Clause><OtherKeyword>EXECUTE</OtherKeyword><WhiteSpace> </WhiteSpace><Other>sp_MS_marksystemobject</Other><WhiteSpace> </WhiteSpace><String>sp_ScriptTable</String><WhiteSpace> </WhiteSpace><Clause><OtherKeyword>EXECUTE</OtherKeyword><WhiteSpace> </WhiteSpace><Other>sp_MS_marksystemobject</Other><WhiteSpace> </WhiteSpace><String>sp_ScriptTable</String><WhiteSpace>
</WhiteSpace></Clause></SqlStatement><BatchSeparator><OtherKeyword>go</OtherKeyword></BatchSeparator><SqlStatement><WhiteSpace>

</WhiteSpace><Clause><DDLProceduralBlock><OtherKeyword>CREATE</OtherKeyword><WhiteSpace> </WhiteSpace><OtherKeyword>PROCEDURE</OtherKeyword><WhiteSpace> </WhiteSpace><Other>AnotherTest</Other><WhiteSpace>
</WhiteSpace><Other>@FirstValue</Other><WhiteSpace> </WhiteSpace><DataTypeKeyword>Int</DataTypeKeyword><Comma>,</Comma><WhiteSpace>
</WhiteSpace><Other>@TestValue</Other><WhiteSpace> </WhiteSpace><DataTypeKeyword>BIT</DataTypeKeyword><WhiteSpace> </WhiteSpace><EqualsSign>=</EqualsSign><WhiteSpace> </WhiteSpace><NumberValue>0</NumberValue><WhiteSpace> </WhiteSpace><OtherKeyword>OUTPUT</OtherKeyword><WhiteSpace>
</WhiteSpace><DDLAsBlock><ContainerOpen><OtherKeyword>AS</OtherKeyword></ContainerOpen><ContainerContentBody><SqlStatement><WhiteSpace>
</WhiteSpace><Clause><OtherKeyword>SELECT</OtherKeyword><WhiteSpace> </WhiteSpace><NumberValue>0</NumberValue><WhiteSpace>


</WhiteSpace></Clause></SqlStatement></SqlRoot> </WhiteSpace></Clause></SqlStatement></ContainerContentBody></DDLAsBlock></DDLProceduralBlock></Clause></SqlStatement></SqlRoot>
Expand Up @@ -394,3 +394,9 @@ END
GO GO


EXECUTE sp_MS_marksystemobject 'sp_ScriptTable' EXECUTE sp_MS_marksystemobject 'sp_ScriptTable'
GO

CREATE PROCEDURE AnotherTest @FirstValue INT
,@TestValue BIT = 0 OUTPUT
AS
SELECT 0

0 comments on commit c87bc88

Please sign in to comment.