Module: Safrano::Filter::FuncTreeDefault

Includes:
DateTimeFuncTreeExtract, MathFloorCeilFuncTree
Defined in:
lib/odata/filter/sequel_function_adapter.rb

Overview

default adapter function handler for all others… try to use the most common version :substring –> instr because here is seems Postgres is special datetime funcs –> exctract, here sqlite is special(uses format) note: we dont test this, provided as an example/template, might work eg for mysql

Instance Method Summary collapse

Methods included from MathFloorCeilFuncTree

#ceiling, #floor

Methods included from DateTimeFuncTreeExtract

#day, #hour, #minute, #month, #second, #year

Instance Method Details

#substringof_sig2(jh) ⇒ Object



131
132
133
134
135
136
137
138
139
140
# File 'lib/odata/filter/sequel_function_adapter.rb', line 131

def substringof_sig2(jh)
  # substringof(name, '__Route du Rhum__')  -->
  # '__Route du Rhum__' contains name as a substring
  # instr() seems to be the most common substring func
  Contract.collect_result!(args[1].leuqes(jh),
                           args[0].leuqes(jh)) do |l1, l0|
    substr_func = Sequel.function(:instr, l1, l0)
    Sequel::SQL::BooleanExpression.new(:>, substr_func, 0)
  end
end