Enable automatically parameterizing queries.
Public Instance methods
complex_expression_sql_append(sql, op, args)
Transform column IN (…) expressions into column = ANY($) and column NOT IN (…) expressions into column != ALL($) using an array bound variable for the ANY/ALL argument, if all values inside the predicate are of the same type and the type is handled by the extension. This is the same optimization PostgreSQL performs internally, but this reduces the number of bound variables.
[show source]
# File lib/sequel/extensions/pg_auto_parameterize_in_array.rb 47 def complex_expression_sql_append(sql, op, args) 48 case op 49 when :IN, :"NOT IN" 50 l, r = args 51 if auto_param?(sql) && (type = _bound_variable_type_for_array(r)) 52 if op == :IN 53 op = :"=" 54 func = :ANY 55 else 56 op = :!= 57 func = :ALL 58 end 59 args = [l, Sequel.function(func, Sequel.pg_array(r, type))] 60 end 61 end 62 63 super 64 end