diff options
author | Jordan <jordan.hollinger@gmail.com> | 2012-02-29 15:14:47 -0500 |
---|---|---|
committer | Jordan <jordan.hollinger@gmail.com> | 2012-02-29 15:14:47 -0500 |
commit | 7cb1044343d474d9174459e9176f144d2b776eec (patch) | |
tree | 22c32f7f301a44d5c2ba1302ab934cee3b4cef84 | |
parent | b757de114cf79d0bab14b086f4ccc7480b9421d8 (diff) | |
download | rails-7cb1044343d474d9174459e9176f144d2b776eec.tar.gz rails-7cb1044343d474d9174459e9176f144d2b776eec.tar.bz2 rails-7cb1044343d474d9174459e9176f144d2b776eec.zip |
Patch Informix Visitor so that it includes joins
-rw-r--r-- | lib/arel/visitors/informix.rb | 2 | ||||
-rw-r--r-- | test/visitors/test_informix.rb | 10 |
2 files changed, 11 insertions, 1 deletions
diff --git a/lib/arel/visitors/informix.rb b/lib/arel/visitors/informix.rb index 25eef1e6de..984098cdf3 100644 --- a/lib/arel/visitors/informix.rb +++ b/lib/arel/visitors/informix.rb @@ -15,7 +15,7 @@ module Arel 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), diff --git a/test/visitors/test_informix.rb b/test/visitors/test_informix.rb index 67b02e0a64..90bbf5c104 100644 --- a/test/visitors/test_informix.rb +++ b/test/visitors/test_informix.rb @@ -37,6 +37,16 @@ module Arel 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 |