diff options
author | Martin Little <mlittle@tempusfactor.com> | 2011-05-16 08:56:54 -0400 |
---|---|---|
committer | Martin Little <mlittle@tempusfactor.com> | 2011-05-16 08:56:54 -0400 |
commit | 85da41912e35eb4c00e10315ecae5edda2c58d4b (patch) | |
tree | 4f61f2985c676fc903c21796aad27ec2db563c14 /lib/arel/visitors | |
parent | 8ec1b8490a383fd0b7189ba05f550853fc37fa72 (diff) | |
download | rails-85da41912e35eb4c00e10315ecae5edda2c58d4b.tar.gz rails-85da41912e35eb4c00e10315ecae5edda2c58d4b.tar.bz2 rails-85da41912e35eb4c00e10315ecae5edda2c58d4b.zip |
Added initial informix visitor support
Diffstat (limited to 'lib/arel/visitors')
-rw-r--r-- | lib/arel/visitors/informix.rb | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/lib/arel/visitors/informix.rb b/lib/arel/visitors/informix.rb new file mode 100644 index 0000000000..cd2ec5d265 --- /dev/null +++ b/lib/arel/visitors/informix.rb @@ -0,0 +1,40 @@ +module Arel + module Visitors + class Informix < Arel::Visitors::ToSql + @skip = nil + @first = nil + private + def visit_Arel_Nodes_SelectStatement o +# @skip = o.offset if o.offset +# @first = o.limit if o.limit + [ + "SELECT", + (visit(o.offset) if o.offset), + (visit(o.limit) if o.limit), + o.cores.map { |x| visit_Arel_Nodes_SelectCore x }.join, + ("ORDER BY #{o.orders.map { |x| visit x }.join(', ')}" unless o.orders.empty?), + (visit(o.lock) if o.lock), + ].compact.join ' ' + end + def visit_Arel_Nodes_SelectCore o + # s,f = @skip,@first + # @skip, @first = nil,nil + [ + "#{o.projections.map { |x| visit x }.join ', '}", + ("FROM #{visit o.froms}" if o.froms), + ("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), + ].compact.join ' ' + end + #(visit(o.offset) if o.offset) + def visit_Arel_Nodes_Offset o + "SKIP #{visit o.expr}" + end + def visit_Arel_Nodes_Limit o + "LIMIT #{visit o.expr}" + end + end + end +end + |