Class: Simple::SQL::Decoder::SingleColumn

Inherits:
Object
  • Object
show all
Defined in:
lib/simple/sql/decoder.rb

Instance Method Summary collapse

Constructor Details

#initialize(connection, result) ⇒ SingleColumn

Returns a new instance of SingleColumn.



85
86
87
88
# File 'lib/simple/sql/decoder.rb', line 85

def initialize(connection, result)
  typename = connection.resolve_type(result.ftype(0), result.fmod(0))
  @field_type = typename.to_sym
end

Instance Method Details

#decode(row) ⇒ Object



90
91
92
93
# File 'lib/simple/sql/decoder.rb', line 90

def decode(row)
  value = row.first
  value && Simple::SQL::Decoder.decode_value(@field_type, value)
end