diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2014-04-08 17:16:21 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2014-04-08 17:16:21 -0700 |
commit | b2fb1d3381027176505e8709acd22295fb57597a (patch) | |
tree | 5ada9d1e99b2360580fe9b614d633cbdcfc5ecb4 /lib/arel/visitors | |
parent | 93036b168b2877f2fe314b7fa0e8701878e32602 (diff) | |
download | rails-b2fb1d3381027176505e8709acd22295fb57597a.tar.gz rails-b2fb1d3381027176505e8709acd22295fb57597a.tar.bz2 rails-b2fb1d3381027176505e8709acd22295fb57597a.zip |
postgresql visitor is working
Diffstat (limited to 'lib/arel/visitors')
-rw-r--r-- | lib/arel/visitors/postgresql.rb | 21 | ||||
-rw-r--r-- | lib/arel/visitors/to_sql.rb | 4 |
2 files changed, 13 insertions, 12 deletions
diff --git a/lib/arel/visitors/postgresql.rb b/lib/arel/visitors/postgresql.rb index 49f7482e7d..60878ddd20 100644 --- a/lib/arel/visitors/postgresql.rb +++ b/lib/arel/visitors/postgresql.rb @@ -3,24 +3,25 @@ module Arel class PostgreSQL < Arel::Visitors::ToSql private - def visit_Arel_Nodes_Matches o - "#{visit o.left} ILIKE #{visit o.right}" + def visit_Arel_Nodes_Matches o, collector + infix_value o, collector, ' ILIKE ' end - def visit_Arel_Nodes_DoesNotMatch o - "#{visit o.left} NOT ILIKE #{visit o.right}" + def visit_Arel_Nodes_DoesNotMatch o, collector + infix_value o, collector, ' NOT ILIKE ' end - def visit_Arel_Nodes_Regexp o - "#{visit o.left} ~ #{visit o.right}" + def visit_Arel_Nodes_Regexp o, collector + infix_value o, collector, ' ~ ' end - def visit_Arel_Nodes_NotRegexp o - "#{visit o.left} !~ #{visit o.right}" + def visit_Arel_Nodes_NotRegexp o, collector + infix_value o, collector, ' !~ ' end - def visit_Arel_Nodes_DistinctOn o - "DISTINCT ON ( #{visit o.expr} )" + def visit_Arel_Nodes_DistinctOn o, collector + collector << "DISTINCT ON ( " + visit(o.expr, collector) << " )" end end end diff --git a/lib/arel/visitors/to_sql.rb b/lib/arel/visitors/to_sql.rb index 0dbec61212..8e254d504b 100644 --- a/lib/arel/visitors/to_sql.rb +++ b/lib/arel/visitors/to_sql.rb @@ -275,8 +275,8 @@ module Arel visit o.expr end - def visit_Arel_Nodes_Distinct o - DISTINCT + def visit_Arel_Nodes_Distinct o, collector + collector << DISTINCT end def visit_Arel_Nodes_DistinctOn o, collector |