Public Instance methods
complex_expression_sql_append
(sql, op, args)
Over the IN/NOT IN handling with an array of values where one of the values in the array is nil, by removing nils from the array of values, and using a separate OR IS NULL clause for IN or AND IS NOT NULL clause for NOT IN.
[show source]
# File lib/sequel/extensions/split_array_nil.rb, line 41 def complex_expression_sql_append(sql, op, args) case op when :IN, :"NOT IN" vals = args.at(1) if vals.is_a?(Array) && vals.any?{|v| v.nil?} cols = args.at(0) vals = vals.compact c = Sequel::SQL::BooleanExpression if op == :IN literal_append(sql, c.new(:OR, c.new(:IN, cols, vals), c.new(:IS, cols, nil))) else literal_append(sql, c.new(:AND, c.new(:"NOT IN", cols, vals), c.new(:"IS NOT", cols, nil))) end else super end else super end end