module Sequel::Dataset::SetLiteralizer
Public Instance Methods
complex_expression_sql_append(sql, op, args)
click to toggle source
Try to generate the same SQL for Set instances used in datasets that would be used for equivalent Array instances.
Calls superclass method
# File lib/sequel/extensions/set_literalizer.rb, line 21 def complex_expression_sql_append(sql, op, args) # Array instances are treated specially by # Sequel::SQL::BooleanExpression.from_value_pairs. That cannot # be modified by a dataset extension, so this tries to convert # the complex expression values generated by default to what would # be the complex expression values used for the equivalent array. case op when :'=', :'!=' if (set = args[1]).is_a?(Set) op = op == :'=' ? :IN : :'NOT IN' col = args[0] array = set.to_a if Sequel.condition_specifier?(array) && col.is_a?(Array) array = Sequel.value_list(array) end args = [col, array] end end super end
Private Instance Methods
literal_other_append(sql, v)
click to toggle source
Literalize Set instances by converting the set to array.
Calls superclass method
# File lib/sequel/extensions/set_literalizer.rb, line 46 def literal_other_append(sql, v) if Set === v literal_append(sql, v.to_a) else super end end