class Sequel::Amalgalite::SequelTypeMap

Type conversion map class for Sequel’s use of Amalgamite

Public Class Methods

new(db) click to toggle source

Store the related database object, in order to be able to correctly handle the database timezone.

   # File lib/sequel/adapters/amalgalite.rb
20 def initialize(db)
21   @db = db
22 end

Public Instance Methods

blob(s) click to toggle source

Return blobs as instances of Sequel::SQL::Blob instead of Amalgamite::Blob

   # File lib/sequel/adapters/amalgalite.rb
26 def blob(s)
27   SQL::Blob.new(s)
28 end
datetime(s) click to toggle source

Return datetime types as instances of Sequel.datetime_class

   # File lib/sequel/adapters/amalgalite.rb
37 def datetime(s)
38   @db.to_application_timestamp(s)
39 end
decimal(s) click to toggle source

Return numeric/decimal types as instances of BigDecimal instead of Float

   # File lib/sequel/adapters/amalgalite.rb
32 def decimal(s)
33   BigDecimal(s)
34 end
result_value_of(declared_type, value) click to toggle source

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.

Calls superclass method
   # File lib/sequel/adapters/amalgalite.rb
47 def result_value_of(declared_type, value)
48   if value.is_a?(::Amalgalite::Blob)
49     SQL::Blob.new(value.to_s)
50   elsif value.is_a?(String) && declared_type
51     (meth = self.class.sql_to_method(declared_type.downcase)) ? public_send(meth, value) : value
52   else
53     super
54   end
55 end
time(s) click to toggle source
   # File lib/sequel/adapters/amalgalite.rb
41 def time(s)
42   Sequel.string_to_time(s)
43 end