aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/arel/visitors/mysql.rb
diff options
context:
space:
mode:
authorDmytro Shteflyuk <kpumuk@kpumuk.info>2018-11-15 14:49:55 -0500
committerRafael França <rafaelmfranca@gmail.com>2018-11-15 14:49:55 -0500
commitb5302d5a820b078b6488104dd695a679e5a49623 (patch)
treea8f393036fd1b72c33d9ed448f6ada379b2dd429 /activerecord/lib/arel/visitors/mysql.rb
parentd1c76dd4b0d308db432afb56c7dafcbefbf4ee3a (diff)
downloadrails-b5302d5a820b078b6488104dd695a679e5a49623.tar.gz
rails-b5302d5a820b078b6488104dd695a679e5a49623.tar.bz2
rails-b5302d5a820b078b6488104dd695a679e5a49623.zip
Arel: Implemented DB-aware NULL-safe comparison (#34451)
* Arel: Implemented DB-aware NULL-safe comparison * Fixed where clause inversion for NULL-safe comparison * Renaming "null_safe_eq" to "is_not_distinct_from", "null_safe_not_eq" to "is_distinct_from" [Dmytro Shteflyuk + Rafael Mendonça França]
Diffstat (limited to 'activerecord/lib/arel/visitors/mysql.rb')
-rw-r--r--activerecord/lib/arel/visitors/mysql.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/activerecord/lib/arel/visitors/mysql.rb b/activerecord/lib/arel/visitors/mysql.rb
index 4e7b2456aa..dd77cfdf66 100644
--- a/activerecord/lib/arel/visitors/mysql.rb
+++ b/activerecord/lib/arel/visitors/mysql.rb
@@ -37,6 +37,17 @@ module Arel # :nodoc: all
collector
end
+ def visit_Arel_Nodes_IsNotDistinctFrom(o, collector)
+ collector = visit o.left, collector
+ collector << " <=> "
+ visit o.right, collector
+ end
+
+ def visit_Arel_Nodes_IsDistinctFrom(o, collector)
+ collector << "NOT "
+ visit_Arel_Nodes_IsNotDistinctFrom o, collector
+ end
+
# In the simple case, MySQL allows us to place JOINs directly into the UPDATE
# query. However, this does not allow for LIMIT, OFFSET and ORDER. To support
# these, we must use a subquery.