diff options
author | Keenan Brock <keenan@thebrocks.net> | 2018-11-13 15:22:08 -0500 |
---|---|---|
committer | Keenan Brock <keenan@thebrocks.net> | 2018-11-13 17:05:45 -0500 |
commit | 63dd8d8e12edb25d8d5bac324aacb1caf05bbe22 (patch) | |
tree | 17be93d6389f6723309979ca2bdb39ac9f9349b7 /activerecord/lib/arel/visitors/mysql.rb | |
parent | 7a954211e6ffe9b482fbd65711edadbb265bf1a7 (diff) | |
download | rails-63dd8d8e12edb25d8d5bac324aacb1caf05bbe22.tar.gz rails-63dd8d8e12edb25d8d5bac324aacb1caf05bbe22.tar.bz2 rails-63dd8d8e12edb25d8d5bac324aacb1caf05bbe22.zip |
Emit single pair of parens for UNION and UNION ALL
mysql has a great implementation to suppress multiple parens for union
sql statements.
This moves that functionality to the generic implementation
This also introduces that functionality for UNION ALL
Diffstat (limited to 'activerecord/lib/arel/visitors/mysql.rb')
-rw-r--r-- | activerecord/lib/arel/visitors/mysql.rb | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/activerecord/lib/arel/visitors/mysql.rb b/activerecord/lib/arel/visitors/mysql.rb index 32f6705d04..4e7b2456aa 100644 --- a/activerecord/lib/arel/visitors/mysql.rb +++ b/activerecord/lib/arel/visitors/mysql.rb @@ -4,34 +4,6 @@ module Arel # :nodoc: all module Visitors class MySQL < Arel::Visitors::ToSql private - def visit_Arel_Nodes_Union(o, collector, suppress_parens = false) - unless suppress_parens - collector << "( " - end - - case o.left - when Arel::Nodes::Union - visit_Arel_Nodes_Union o.left, collector, true - else - visit o.left, collector - end - - collector << " UNION " - - case o.right - when Arel::Nodes::Union - visit_Arel_Nodes_Union o.right, collector, true - else - visit o.right, collector - end - - if suppress_parens - collector - else - collector << " )" - end - end - def visit_Arel_Nodes_Bin(o, collector) collector << "BINARY " visit o.expr, collector |