Class: PG::BasicTypeMapForResults::WarningTypeMap

### Home Classes Methods

### In Files

- lib/pg/basic_type_mapping.rb

### Parent

PG::TypeMapInRuby

### Methods

- ::new
- #typecast_result_value

### Files

- LICENSE
- Manifest.txt
- POSTGRES
- README-OS_X.rdoc
- README-Windows.rdoc
- README.ja.rdoc
- README.rdoc
- errorcodes.txt

### Class/Module Index

Quicksearch

- PG
- PG::BasicTypeMapBasedOnResult
- PG::BasicTypeMapForQueries
- PG::BasicTypeMapForResults
- PG::BasicTypeMapForResults::WarningTypeMap
- PG::BasicTypeRegistry
- PG::BasicTypeRegistry::CoderMap
- PG::Coder
- PG::Coder::BinaryFormatting
- PG::CompositeCoder
- PG::Connection
- PG::Connection
- PG::Constants
- PG::CopyCoder
- PG::Error
- PG::NotAllCopyDataRetrieved
- PG::Result
- PG::Result
- PG::TextDecoder
- PG::TextDecoder::Date
- PG::TextDecoder::TimestampWithTimeZone
- PG::TextDecoder::TimestampWithoutTimeZone
- PG::TextEncoder
- PG::TextEncoder::Date
- PG::TextEncoder::TimestampWithTimeZone
- PG::TextEncoder::TimestampWithoutTimeZone
- PG::TypeMapByColumn
- Object
- Object::PGconn
- Object::PGresult

No matching classes.

# PG::BasicTypeMapForResults::WarningTypeMap

### Public Class Methods

new(typenames) click to toggle source

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

### Public Instance Methods

typecast_result_value(result, _tuple, field) click to toggle source

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

[Validate]

Generated with the Darkfish Rdoc Generator 2.