diff options
-rw-r--r-- | lib/arel/visitors/mysql.rb | 5 | ||||
-rw-r--r-- | lib/arel/visitors/to_sql.rb | 4 | ||||
-rw-r--r-- | test/nodes/test_bin.rb | 4 |
3 files changed, 7 insertions, 6 deletions
diff --git a/lib/arel/visitors/mysql.rb b/lib/arel/visitors/mysql.rb index cf590598e1..92348ca7e3 100644 --- a/lib/arel/visitors/mysql.rb +++ b/lib/arel/visitors/mysql.rb @@ -30,8 +30,9 @@ module Arel end end - def visit_Arel_Nodes_Bin o - "BINARY #{visit o.expr}" + def visit_Arel_Nodes_Bin o, collector + collector << "BINARY " + visit o.expr, collector end ### diff --git a/lib/arel/visitors/to_sql.rb b/lib/arel/visitors/to_sql.rb index 9ec926a66e..cba289c35c 100644 --- a/lib/arel/visitors/to_sql.rb +++ b/lib/arel/visitors/to_sql.rb @@ -274,8 +274,8 @@ module Arel collector end - def visit_Arel_Nodes_Bin o - visit o.expr + def visit_Arel_Nodes_Bin o, collector + visit o.expr, collector end def visit_Arel_Nodes_Distinct o, collector diff --git a/test/nodes/test_bin.rb b/test/nodes/test_bin.rb index 1d955b218b..0dcc5f7bb8 100644 --- a/test/nodes/test_bin.rb +++ b/test/nodes/test_bin.rb @@ -10,13 +10,13 @@ module Arel def test_default_to_sql viz = Arel::Visitors::ToSql.new Table.engine.connection_pool node = Arel::Nodes::Bin.new(Arel.sql('zomg')) - assert_equal 'zomg', viz.accept(node) + assert_equal 'zomg', viz.accept(node, Collectors::SQLString.new).value end def test_mysql_to_sql viz = Arel::Visitors::MySQL.new Table.engine.connection_pool node = Arel::Nodes::Bin.new(Arel.sql('zomg')) - assert_equal 'BINARY zomg', viz.accept(node) + assert_equal 'BINARY zomg', viz.accept(node, Collectors::SQLString.new).value end def test_equality_with_same_ivars |