aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/visitors/to_sql.rb
diff options
context:
space:
mode:
authorTamir Duberstein <tamird@squareup.com>2014-09-24 19:01:33 -0700
committerTamir Duberstein <tamird@squareup.com>2014-09-25 13:30:03 -0700
commitfef9ce493ec3eab3cf120550abd0257f89eaddf7 (patch)
tree6f607b2c312db046a488629f39bd8755b4cbc5c9 /lib/arel/visitors/to_sql.rb
parentb57a11cb8abfca345f63084ce841c6f412c1156e (diff)
downloadrails-fef9ce493ec3eab3cf120550abd0257f89eaddf7.tar.gz
rails-fef9ce493ec3eab3cf120550abd0257f89eaddf7.tar.bz2
rails-fef9ce493ec3eab3cf120550abd0257f89eaddf7.zip
{Matches,DoesNotMatch} support the ESCAPE clause
Diffstat (limited to 'lib/arel/visitors/to_sql.rb')
-rw-r--r--lib/arel/visitors/to_sql.rb16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/arel/visitors/to_sql.rb b/lib/arel/visitors/to_sql.rb
index 7bef8feded..7fa3322148 100644
--- a/lib/arel/visitors/to_sql.rb
+++ b/lib/arel/visitors/to_sql.rb
@@ -539,13 +539,25 @@ module Arel
def visit_Arel_Nodes_Matches o, collector
collector = visit o.left, collector
collector << " LIKE "
- visit o.right, collector
+ collector = visit o.right, collector
+ if o.escape
+ collector << ' ESCAPE '
+ visit o.escape, collector
+ else
+ collector
+ end
end
def visit_Arel_Nodes_DoesNotMatch o, collector
collector = visit o.left, collector
collector << " NOT LIKE "
- visit o.right, collector
+ collector = visit o.right, collector
+ if o.escape
+ collector << ' ESCAPE '
+ visit o.escape, collector
+ else
+ collector
+ end
end
def visit_Arel_Nodes_JoinSource o, collector