Sha256: b8e506d290b2334061d21567108a53a2d8749ed1ce78918a182bad6cad68b4dd

Contents?: true

Size: 1.51 KB

Versions: 10

Compression:

Stored size: 1.51 KB

Contents

# frozen_string_literal: true

# 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(precision: nil, limit: nil, scale: nil)
            super
            @precision = 19
            @scale = 4
          end
          def type
            :money
          end
        end

        class SmallMoney < Decimal
          def initialize(precision: nil, limit: nil, scale: nil)
            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

10 entries across 10 versions & 1 rubygems

Version Path
activerecord-jdbc-alt-adapter-72.0.0.rc1-java lib/arjdbc/mssql/types/numeric_types.rb
activerecord-jdbc-alt-adapter-72.0.0.alpha1-java lib/arjdbc/mssql/types/numeric_types.rb
activerecord-jdbc-alt-adapter-71.0.0-java lib/arjdbc/mssql/types/numeric_types.rb
activerecord-jdbc-alt-adapter-71.0.0.alpha2-java lib/arjdbc/mssql/types/numeric_types.rb
activerecord-jdbc-alt-adapter-71.0.0.alpha1-java lib/arjdbc/mssql/types/numeric_types.rb
activerecord-jdbc-alt-adapter-70.2.0-java lib/arjdbc/mssql/types/numeric_types.rb
activerecord-jdbc-alt-adapter-70.1.0-java lib/arjdbc/mssql/types/numeric_types.rb
activerecord-jdbc-alt-adapter-70.0.0-java lib/arjdbc/mssql/types/numeric_types.rb
activerecord-jdbc-alt-adapter-70.0.0.rc2-java lib/arjdbc/mssql/types/numeric_types.rb
activerecord-jdbc-alt-adapter-70.0.0.rc1-java lib/arjdbc/mssql/types/numeric_types.rb