Module: ArJdbc::Derby::Column

Defined in:
lib/arjdbc/derby/adapter.rb

Instance Method Summary collapse

Instance Method Details

#default_value(value) ⇒ Object

Post process default value from JDBC into a Rails-friendly format (columns-internal)



50
51
52
53
54
55
# File 'lib/arjdbc/derby/adapter.rb', line 50

def default_value(value)
  # jdbc returns column default strings with actual single quotes around the value.
  return $1 if value =~ /^'(.*)'$/

  value
end

#simplified_type(field_type) ⇒ Object



39
40
41
42
43
44
45
46
47
# File 'lib/arjdbc/derby/adapter.rb', line 39

def simplified_type(field_type)
  case field_type
  when /smallint/i  then :boolean
  when /real/i      then :float
  when /decimal/i   then :decimal
  else
    super
  end
end