Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Patch Informix Visitor so that it includes joins

  • Loading branch information...
commit 7cb1044343d474d9174459e9176f144d2b776eec 1 parent b757de1
@jhollinger jhollinger authored
Showing with 11 additions and 1 deletion.
  1. +1 −1  lib/arel/visitors/informix.rb
  2. +10 −0 test/visitors/test_informix.rb
View
2  lib/arel/visitors/informix.rb
@@ -15,7 +15,7 @@ def visit_Arel_Nodes_SelectStatement o
def visit_Arel_Nodes_SelectCore o
[
"#{o.projections.map { |x| visit x }.join ', '}",
- ("FROM #{visit o.froms}" if o.froms),
+ ("FROM #{visit(o.source)}" if o.source && !o.source.empty?),
("WHERE #{o.wheres.map { |x| visit x }.join ' AND ' }" unless o.wheres.empty?),
("GROUP BY #{o.groups.map { |x| visit x }.join ', ' }" unless o.groups.empty?),
(visit(o.having) if o.having),
View
10 test/visitors/test_informix.rb
@@ -37,6 +37,16 @@ module Visitors
sql.must_be_like "SELECT SKIP 1 LIMIT 1"
end
+ it 'uses INNER JOIN to perform joins' do
+ core = Nodes::SelectCore.new
+ table = Table.new(:posts)
+ core.source = Nodes::JoinSource.new(table, [table.create_join(Table.new(:comments))])
+
+ stmt = Nodes::SelectStatement.new([core])
+ sql = @visitor.accept(stmt)
+ sql.must_be_like 'SELECT FROM "posts" INNER JOIN "comments"'
+ end
+
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.