module Sequel::Postgres::ExtendedIntegerSupport

Public Instance Methods

integer_outside_bigint_range_strategy(strategy) click to toggle source

Set the strategy for handling integers outside PostgreSQL bigint range. Supported values:

:quote

Quote the integer value. PostgreSQL will treat the integer as a unknown type, implicitly casting to any other type as needed. This is the default value when using the pg_extended_integer_support extension.

:raise

Raise error when attempting to literalize the integer (the default behavior of Sequel on PostgreSQL when not using the pg_extended_integer_support extension).

:raw

Use raw integer value without quoting. PostgreSQL will treat the integer as a numeric. This was Sequel's historical behavior, but it is unlikely to be desired.

# File lib/sequel/extensions/pg_extended_integer_support.rb, line 93
def integer_outside_bigint_range_strategy(strategy)
  clone(:integer_outside_bigint_range_strategy=>strategy)
end

Private Instance Methods

literal_integer_outside_bigint_range(v) click to toggle source

Handle integers outside the bigint range by using the configured strategy.

Calls superclass method
# File lib/sequel/extensions/pg_extended_integer_support.rb, line 101
def literal_integer_outside_bigint_range(v)
  case @opts[:integer_outside_bigint_range_strategy] || @db.opts[:integer_outside_bigint_range_strategy]
  when :raise
    super
  when :raw
    v.to_s
  else # when :quote
    "'#{v}'"
  end
end