diff options
author | Kazuya NUMATA <numata@gmail.com> | 2014-12-25 12:58:42 +0900 |
---|---|---|
committer | Kazuya NUMATA <numata@gmail.com> | 2014-12-25 12:58:42 +0900 |
commit | 2c95c39e9345ef50a7e9c3ad573857b1d358e04a (patch) | |
tree | b838d8bece807bb34684f6999065d0a6543d0726 /lib/arel/visitors | |
parent | 0cd5fa9671592a16ee34f0718704b15f27911620 (diff) | |
download | rails-2c95c39e9345ef50a7e9c3ad573857b1d358e04a.tar.gz rails-2c95c39e9345ef50a7e9c3ad573857b1d358e04a.tar.bz2 rails-2c95c39e9345ef50a7e9c3ad573857b1d358e04a.zip |
{Matches,DoesNotMatch} support the ESCAPE clause with PostgreSQL
to_SQL already has supported the ESCAPE clause in #318.
PostgreSQL can use the ESCAPE clause too.
Diffstat (limited to 'lib/arel/visitors')
-rw-r--r-- | lib/arel/visitors/postgresql.rb | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/arel/visitors/postgresql.rb b/lib/arel/visitors/postgresql.rb index f55aaf30fe..bd23fc0a47 100644 --- a/lib/arel/visitors/postgresql.rb +++ b/lib/arel/visitors/postgresql.rb @@ -4,11 +4,23 @@ module Arel private def visit_Arel_Nodes_Matches o, collector - infix_value o, collector, ' ILIKE ' + collector = infix_value o, collector, ' ILIKE ' + if o.escape + collector << ' ESCAPE ' + visit o.escape, collector + else + collector + end end def visit_Arel_Nodes_DoesNotMatch o, collector - infix_value o, collector, ' NOT ILIKE ' + collector = infix_value o, collector, ' NOT ILIKE ' + if o.escape + collector << ' ESCAPE ' + visit o.escape, collector + else + collector + end end def visit_Arel_Nodes_Regexp o, collector |