| Class | Sequel::Amalgalite::SequelTypeMap |
| In: |
lib/sequel/adapters/amalgalite.rb
|
| Parent: | ::Amalgalite::TypeMaps::DefaultMap |
Type conversion map class for Sequel‘s use of Amalgamite
Return blobs as instances of Sequel::SQL::Blob instead of Amalgamite::Blob
# File lib/sequel/adapters/amalgalite.rb, line 20
20: def blob(s)
21: SQL::Blob.new(s)
22: end
Return numeric/decimal types as instances of BigDecimal instead of Float
# File lib/sequel/adapters/amalgalite.rb, line 26
26: def decimal(s)
27: BigDecimal.new(s)
28: end
Don‘t raise an error if the value is a string and the declared type doesn‘t match a known type, just return the value.
# File lib/sequel/adapters/amalgalite.rb, line 37
37: def result_value_of(declared_type, value)
38: if value.is_a?(::Amalgalite::Blob)
39: SQL::Blob.new(value.source)
40: elsif value.is_a?(String) && declared_type
41: (meth = self.class.sql_to_method(declared_type.downcase)) ? send(meth, value) : value
42: else
43: super
44: end
45: end