Skip to content

Commit

Permalink
Disabled parentheses for SQLFunctionExpression when no parameters. Cl…
Browse files Browse the repository at this point in the history
…oses #35.
  • Loading branch information
hisystems committed Mar 22, 2012
1 parent abd5b34 commit 691500c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion SQL/Expressions/SQLFunctionExpression.vb
Expand Up @@ -25,6 +25,8 @@ Namespace SQL
Private pstrFunctionName As String
Private pobjFunctionArguments As SQLExpression()

Public IncludeParenthesesWhenArgumentsEmpty As Boolean = False

Public Sub New(strFunctionName As String)

If String.IsNullOrEmpty(strFunctionName) Then
Expand Down Expand Up @@ -78,7 +80,11 @@ Namespace SQL
strArguments = String.Join(", ", pobjFunctionArguments.Select(Function(argument) argument.SQL(eConnectionType)).ToArray)
End If

Return Me.FunctionName(eConnectionType) & "(" & strArguments & ")"
If (IncludeParenthesesWhenArgumentsEmpty AndAlso pobjFunctionArguments Is Nothing) OrElse pobjFunctionArguments IsNot Nothing Then
strArguments = "(" & strArguments & ")"
End If

Return Me.FunctionName(eConnectionType) & strArguments

End Function

Expand Down

0 comments on commit 691500c

Please sign in to comment.