class Sequel::Amalgalite::SequelTypeMap

Type conversion map class for Sequel's use of Amalgamite

Constants

SQL_TO_METHOD

Amalgalite 2 support

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
46 def initialize(db)
47   @db = db
48 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
52 def blob(s)
53   SQL::Blob.new(s)
54 end
datetime(s) click to toggle source

Return datetime types as instances of Sequel.datetime_class

   # File lib/sequel/adapters/amalgalite.rb
63 def datetime(s)
64   @db.to_application_timestamp(s)
65 end
decimal(s) click to toggle source

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

   # File lib/sequel/adapters/amalgalite.rb
58 def decimal(s)
59   BigDecimal(s)
60 end
result_value_method(type) click to toggle source
   # File lib/sequel/adapters/amalgalite.rb
21 def result_value_method(type)
22   self.class.sql_to_method(type)
23 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
73 def result_value_of(declared_type, value)
74   if value.is_a?(::Amalgalite::Blob)
75     SQL::Blob.new(value.to_s)
76   elsif value.is_a?(String) && declared_type
77     (meth = result_value_method(declared_type.downcase)) ? public_send(meth, value) : value
78   else
79     super
80   end
81 end
time(s) click to toggle source
   # File lib/sequel/adapters/amalgalite.rb
67 def time(s)
68   Sequel.string_to_time(s)
69 end