module Sequel::Dataset::SetLiteralizer
Public Instance Methods
Source
# File lib/sequel/extensions/set_literalizer.rb 22 def complex_expression_sql_append(sql, op, args) 23 # Array instances are treated specially by 24 # Sequel::SQL::BooleanExpression.from_value_pairs. That cannot 25 # be modified by a dataset extension, so this tries to convert 26 # the complex expression values generated by default to what would 27 # be the complex expression values used for the equivalent array. 28 case op 29 when :'=', :'!=' 30 if (set = args[1]).is_a?(Set) 31 op = op == :'=' ? :IN : :'NOT IN' 32 col = args[0] 33 array = set.to_a 34 if Sequel.condition_specifier?(array) && col.is_a?(Array) 35 array = Sequel.value_list(array) 36 end 37 args = [col, array] 38 end 39 end 40 41 super 42 end
Try to generate the same SQL
for Set instances used in datasets that would be used for equivalent Array
instances.
Calls superclass method
Private Instance Methods
Source
# File lib/sequel/extensions/set_literalizer.rb 47 def literal_other_append(sql, v) 48 if Set === v 49 literal_append(sql, v.to_a) 50 else 51 super 52 end 53 end
Literalize Set instances by converting the set to array.
Calls superclass method