38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/jdbc_adapter/jdbc_sqlite3.rb', line 38
def type_cast(value)
return nil if value.nil?
case type
when :string then value
when :integer then defined?(value.to_i) ? value.to_i : (value ? 1 : 0)
when :primary_key then defined?(value.to_i) ? value.to_i : (value ? 1 : 0)
when :float then value.to_f
when :datetime then JdbcSpec::SQLite3::Column.cast_to_date_or_time(value)
when :date then JdbcSpec::SQLite3::Column.cast_to_date_or_time(value)
when :time then JdbcSpec::SQLite3::Column.cast_to_time(value)
when :decimal then self.class.value_to_decimal(value)
when :boolean then self.class.value_to_boolean(value)
else value
end
end
|