Class: FunctionCall

Inherits:
Expression show all
Defined in:
lib/eno/expressions.rb

Constant Summary collapse

S_FUN_NO_ARGS =
'%s()'
S_FUN =
'%s(%s)'

Constants inherited from Expression

Expression::S_AND, Expression::S_DIV, Expression::S_EQ, Expression::S_GT, Expression::S_GTE, Expression::S_LT, Expression::S_LTE, Expression::S_MINUS, Expression::S_MOD, Expression::S_MUL, Expression::S_NEQ, Expression::S_OR, Expression::S_PLUS, Expression::S_TILDE

Instance Attribute Summary

Attributes inherited from Expression

#members, #props

Instance Method Summary collapse

Methods inherited from Expression

#!=, #!@, #%, #&, #*, #+, #-, #/, #<, #<=, #==, #=~, #>, #>=, #^, #as, #cast, #desc, #in, #initialize, #inner_join, #join, #not_in, #not_null?, #null?, #over, #|

Constructor Details

This class inherits a constructor from Expression

Instance Method Details

#to_sql(sql) ⇒ Object



232
233
234
235
236
237
238
239
240
241
242
# File 'lib/eno/expressions.rb', line 232

def to_sql(sql)
  fun = @members[0]
  if @members.size == 2 && Identifier === @members.last && @members.last._empty_placeholder?
    S_FUN_NO_ARGS % fun
  else
    S_FUN % [
      fun,
      @members[1..-1].map { |a| sql.quote(a) }.join(S_COMMA)
    ]
  end
end