Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

adding select statement support

  • Loading branch information...
commit 4b91cbc688b2fdc09a4a67a018c6bcb773934ea1 1 parent 61e0280
@tenderlove tenderlove authored
View
9 lib/arel/visitors/depth_first.rb
@@ -70,6 +70,15 @@ def visit_Arel_Nodes_SelectCore o
@block.call o
end
+ def visit_Arel_Nodes_SelectStatement o
+ visit o.cores
+ visit o.orders
+ visit o.limit
+ visit o.lock
+ visit o.offset
+ @block.call o
+ end
+
def visit_Arel_Nodes_UpdateStatement o
visit o.relation
visit o.values
View
18 test/visitors/test_depth_first.rb
@@ -102,6 +102,24 @@ def test_select_core
:e,
core], @collector.calls
end
+
+ def test_select_statement
+ ss = Nodes::SelectStatement.new
+ ss.cores.replace [:a]
+ ss.orders << :b
+ ss.limit = :c
+ ss.lock = :d
+ ss.offset = :e
+
+ @visitor.accept ss
+ assert_equal [
+ :a, ss.cores,
+ :b, ss.orders,
+ :c,
+ :d,
+ :e,
+ ss], @collector.calls
+ end
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.