Sha256: 3dcfd3384b53ee504eb5a3e5fd30e88061d68438f1c7aeb4ad11d5dca46470e5

Contents?: true

Size: 1.05 KB

Versions: 28

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 Integer
        ::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

28 entries across 28 versions & 1 rubygems

Version Path
amalgalite-1.9.4-x64-mingw-ucrt lib/amalgalite/type_maps/storage_map.rb
amalgalite-1.9.4-x86-mingw32 lib/amalgalite/type_maps/storage_map.rb
amalgalite-1.9.4-x64-mingw32 lib/amalgalite/type_maps/storage_map.rb
amalgalite-1.9.4 lib/amalgalite/type_maps/storage_map.rb
amalgalite-1.9.1-x86-mingw32 lib/amalgalite/type_maps/storage_map.rb
amalgalite-1.9.1-x64-mingw32 lib/amalgalite/type_maps/storage_map.rb
amalgalite-1.9.1-x64-mingw-ucrt lib/amalgalite/type_maps/storage_map.rb
amalgalite-1.9.1 lib/amalgalite/type_maps/storage_map.rb
amalgalite-1.9.0-x64-mingw-ucrt lib/amalgalite/type_maps/storage_map.rb
amalgalite-1.9.0-x86-mingw32 lib/amalgalite/type_maps/storage_map.rb
amalgalite-1.9.0-x64-mingw32 lib/amalgalite/type_maps/storage_map.rb
amalgalite-1.9.0 lib/amalgalite/type_maps/storage_map.rb
amalgalite-1.8.0-x64-mingw-ucrt lib/amalgalite/type_maps/storage_map.rb
amalgalite-1.8.0-x64-mingw32 lib/amalgalite/type_maps/storage_map.rb
amalgalite-1.8.0-x86-mingw32 lib/amalgalite/type_maps/storage_map.rb
amalgalite-1.8.0 lib/amalgalite/type_maps/storage_map.rb
amalgalite-1.7.0-x86-mingw32 lib/amalgalite/type_maps/storage_map.rb
amalgalite-1.7.0-x64-mingw32 lib/amalgalite/type_maps/storage_map.rb
amalgalite-1.7.0 lib/amalgalite/type_maps/storage_map.rb
amalgalite-1.6.3-x86-mingw32 lib/amalgalite/type_maps/storage_map.rb