@@ -5,6 +5,14 @@ function prefix(io, call, argument1)
55 print (io, argument1)
66end
77
8+ function parenthesize_prefix (io, call, argument1)
9+ print (io, call)
10+ print (io, ' ' )
11+ print (io, ' (' )
12+ print (io, argument1)
13+ print (io, ' )' )
14+ end
15+
816function postfix (io, call, argument1)
917 print (io, argument1)
1018 print (io, ' ' )
@@ -17,6 +25,14 @@ function tight_infix(io, call, argument1, argument2)
1725 print (io, argument2)
1826end
1927
28+ function parenthesize_infix (io, call, argument1, argument2)
29+ print (io, argument1)
30+ print (io, ' ' )
31+ print (io, call)
32+ print (io, ' ' )
33+ print (io, argument2)
34+ end
35+
2036function infix (io, call, argument1, argument2, arguments... )
2137 print (io, argument1)
2238 print (io, ' ' )
@@ -89,13 +105,13 @@ function show(io::IO, sql_expression::SQLExpression)
89105 elseif call === :AND
90106 infix (io, call, arguments... )
91107 elseif call === :AS
92- infix (io, call, arguments... )
108+ parenthesize_infix (io, call, arguments... )
93109 elseif call === :CASE
94110 case (io, call, arguments... )
95111 elseif call === :DESC
96112 postfix (io, call, arguments... )
97113 elseif call === :FROM
98- prefix (io, call, arguments... )
114+ parenthesize_prefix (io, call, arguments... )
99115 elseif call === Symbol (" GROUP BY" )
100116 head_call_tail (io, call, arguments... )
101117 elseif call === :IN
0 commit comments