Module: ActiveRecord::ConnectionAdapters::PostgreSQL::OID

Defined in:
lib/arjdbc/postgresql/base/oid.rb

Defined Under Namespace

Classes: Array, Bit, Boolean, Bytea, Cidr, Date, Decimal, Float, Hstore, Identity, Integer, Json, Jsonb, Money, Point, Range, Time, Timestamp, Type, TypeMap, Vector

Constant Summary collapse

NAMES =

When the PG adapter connects, the pg_type table is queried. The key of this hash maps to the typname column from the table. type_map is then dynamically built with oids as the key and type objects as values.

Hash.new { |h,k| # :nodoc:
  h[k] = OID::Identity.new
}

Class Method Summary collapse

Class Method Details

.alias_type(new, old) ⇒ Object

Alias the +old+ type to the +new+ type.



350
351
352
# File 'lib/arjdbc/postgresql/base/oid.rb', line 350

def self.alias_type(new, old)
  NAMES[new] = NAMES[old]
end

.register_type(name, type) ⇒ Object

Register an OID type named +name+ with a typecasting object in +type+. +name+ should correspond to the typname column in the pg_type table.



345
346
347
# File 'lib/arjdbc/postgresql/base/oid.rb', line 345

def self.register_type(name, type)
  NAMES[name] = type
end

.registered_type?(name) ⇒ Boolean

Is +name+ a registered type?

Returns:



355
356
357
# File 'lib/arjdbc/postgresql/base/oid.rb', line 355

def self.registered_type?(name)
  NAMES.key? name
end