Sha256: 4aef8f2959574cdab60c9324d7ecf9f71f27c03cf61fd41d8173c96a5763a16e

Contents?: true

Size: 1.05 KB

Versions: 9

Compression:

Stored size: 1.05 KB

Contents

#--
# Copyright (c) 2008 Jeremy Hinegardner
# All rights reserved.  See LICENSE and/or COPYING for details.
#++

module Amalgalite::TypeMaps
  ##
  # An Amalagliate TypeMap that has a one-to-one conversion between SQLite types
  # and Ruby classes
  #
  class StorageMap < ::Amalgalite::TypeMap
    ##
    # A straight logical mapping (for me at least) of basic Ruby classes to SQLite types, if
    # nothing can be found then default to TEXT.
    #
    def bind_type_of( obj )
      case obj
      when Float
        ::Amalgalite::SQLite3::Constants::DataType::FLOAT
      when Fixnum
        ::Amalgalite::SQLite3::Constants::DataType::INTEGER
      when NilClass
        ::Amalgalite::SQLite3::Constants::DataType::NULL
      when ::Amalgalite::Blob
        ::Amalgalite::SQLite3::Constants::DataType::BLOB
      else
        ::Amalgalite::SQLite3::Constants::DataType::TEXT
      end
    end

    ##
    # Do no mapping, just return the value as it was retrieved from SQLite.
    #
    def result_value_of( delcared_type, value )
      return value
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
amalgalite-1.5.0-x86-mingw32 lib/amalgalite/type_maps/storage_map.rb
amalgalite-1.5.0 lib/amalgalite/type_maps/storage_map.rb
amalgalite-1.4.1-x86-mingw32 lib/amalgalite/type_maps/storage_map.rb
amalgalite-1.4.1 lib/amalgalite/type_maps/storage_map.rb
amalgalite-1.4.0-x86-mingw32 lib/amalgalite/type_maps/storage_map.rb
amalgalite-1.4.0 lib/amalgalite/type_maps/storage_map.rb
asana2flowdock-1.0.0 vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/type_maps/storage_map.rb
amalgalite-1.3.0-x86-mswin32 lib/amalgalite/type_maps/storage_map.rb
amalgalite-1.3.0 lib/amalgalite/type_maps/storage_map.rb