PG::BasicTypeMapForResults::

WarningTypeMap

class
Superclass
PG::TypeMapInRuby

Public Class Methods

anchor
new(typenames)
# File lib/pg/basic_type_map_for_results.rb, line 53
def initialize(typenames)
        @already_warned = Hash.new{|h, k| h[k] = {} }
        @typenames_by_oid = typenames
end

Public Instance Methods

anchor
typecast_result_value(result, _tuple, field)
# File lib/pg/basic_type_map_for_results.rb, line 58
def typecast_result_value(result, _tuple, field)
        format = result.fformat(field)
        oid = result.ftype(field)
        unless @already_warned[format][oid]
                warn "Warning: no type cast defined for type #{@typenames_by_oid[oid].inspect} format #{format} with oid #{oid}. Please cast this type explicitly to TEXT to be safe for future changes."
                 @already_warned[format][oid] = true
        end
        super
end