Sha256: ee18a104cbef03ed58cfc9cfba2fc16e7d753c472c15422a77d99f325d308f7c

Contents?: true

Size: 1.43 KB

Versions: 23

Compression:

Stored size: 1.43 KB

Contents

# MSSQL numeric types definitions
module ActiveRecord
  module ConnectionAdapters
    module MSSQL
      module Type

        # Exact numerics
        class Integer < ActiveRecord::Type::Integer
        end

        class TinyInteger < ActiveRecord::Type::Integer
          def max_value
            256
          end

          def min_value
            0
          end
        end

        class SmallInteger < ActiveRecord::Type::Integer
        end

        class BigInteger < ActiveRecord::Type::Integer
        end

        class Decimal < ActiveRecord::Type::Decimal
        end

        # This type is used when scale is 0 and the default value in
        # SQL Server when it is not provided
        class DecimalWithoutScale < ActiveRecord::Type::DecimalWithoutScale
        end

        class Money < Decimal
          def initialize(options = {})
            super
            @precision = 19
            @scale = 4
          end
          def type
            :money
          end
        end

        class SmallMoney < Decimal
          def initialize(options = {})
            super
            @precision = 10
            @scale = 4
          end

          def type
            :smallmoney
          end
        end

        # Approximate numerics
        class Float < ActiveRecord::Type::Float
        end

        class Real < ActiveRecord::Type::Float
          def type
            :real
          end
        end

      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
activerecord-jdbc-alt-adapter-52.6.0-java lib/arjdbc/mssql/types/numeric_types.rb
activerecord-jdbc-alt-adapter-51.7.0-java lib/arjdbc/mssql/types/numeric_types.rb
activerecord-jdbc-alt-adapter-50.7.0-java lib/arjdbc/mssql/types/numeric_types.rb
activerecord-jdbc-alt-adapter-52.5.1-java lib/arjdbc/mssql/types/numeric_types.rb
activerecord-jdbc-alt-adapter-51.6.1-java lib/arjdbc/mssql/types/numeric_types.rb
activerecord-jdbc-alt-adapter-50.6.1-java lib/arjdbc/mssql/types/numeric_types.rb
activerecord-jdbc-alt-adapter-52.4.0-java lib/arjdbc/mssql/types/numeric_types.rb
activerecord-jdbc-alt-adapter-51.5.0-java lib/arjdbc/mssql/types/numeric_types.rb
activerecord-jdbc-alt-adapter-50.5.0-java lib/arjdbc/mssql/types/numeric_types.rb
activerecord-jdbc-alt-adapter-50.3.4-java lib/arjdbc/mssql/types/numeric_types.rb
activerecord-jdbc-alt-adapter-51.3.4-java lib/arjdbc/mssql/types/numeric_types.rb
activerecord-jdbc-alt-adapter-52.2.3-java lib/arjdbc/mssql/types/numeric_types.rb
activerecord-jdbc-alt-adapter-52.2.2-java lib/arjdbc/mssql/types/numeric_types.rb
activerecord-jdbc-alt-adapter-50.3.3-java lib/arjdbc/mssql/types/numeric_types.rb
activerecord-jdbc-alt-adapter-51.3.3-java lib/arjdbc/mssql/types/numeric_types.rb
activerecord-jdbc-alt-adapter-50.3.2-java lib/arjdbc/mssql/types/numeric_types.rb
activerecord-jdbc-alt-adapter-51.3.2-java lib/arjdbc/mssql/types/numeric_types.rb
activerecord-jdbc-alt-adapter-52.2.1-java lib/arjdbc/mssql/types/numeric_types.rb
activerecord-jdbc-alt-adapter-51.3.1-java lib/arjdbc/mssql/types/numeric_types.rb
activerecord-jdbc-alt-adapter-52.2.0-java lib/arjdbc/mssql/types/numeric_types.rb