Class: Rusql::ConvertTzFunctionOperand

Inherits:
Operand
  • Object
show all
Defined in:
lib/rusql/convert_tz_function_operand.rb

Instance Method Summary collapse

Methods inherited from Operand

#like, #to_s

Constructor Details

#initialize(op, from, to) ⇒ ConvertTzFunctionOperand

Returns a new instance of ConvertTzFunctionOperand.

Raises:



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/rusql/convert_tz_function_operand.rb', line 3

def initialize(op, from, to)
  raise TypeException.new(String, from.class) unless from.is_a?(String)
  raise TypeException.new(String, to.class) unless to.is_a?(String)

  op_string = case op
              when Column
                op.as_operand.to_s
              else
                op.to_s
              end

  super("CONVERT_TZ(#{ op_string }, #{ convert_value(from) }, #{ convert_value(to) })")
end