lib/arjdbc/postgresql/oid_types.rb
# Support arrays/ranges for defining attributes that don't exist in the db
Support arrays/ranges for defining attributes that don't exist in the db
Support arrays / ranges for defining attributes that don ' t exist in the db
def load_additional_types(type_map, oids = nil)
        if supports_ranges?
          query = <<-SQL
            SELECT t.oid, t.typname, t.typelem, t.typdelim, t.typinput, r.rngsubtype, t.typtype, t.typbasetype
            FROM pg_type as t
            LEFT JOIN pg_range as r ON oid = rngtypid
          SQL
        else
          query = <<-SQL
            SELECT t.oid, t.typname, t.typelem, t.typdelim, t.typinput, t.typtype, t.typbasetype
            FROM pg_type as t
          SQL
        end
        initializer = OID::TypeMapInitializer.new(type_map)
        if oids
          query << ( "WHERE t.oid::integer IN (%s)" % oids.join(", ") )
        else
          if initializer.respond_to?(:query_conditions_for_initial_load)
            query << initializer.query_conditions_for_initial_load(type_map)
          end
        end
        records = execute(query, 'SCHEMA')
        initializer.run(records)
      end
def load_additional_types ( type_map , oids = nil ) if supports_ranges? query = <<-SQL 
            SELECT t.oid, t.typname, t.typelem, t.typdelim, t.typinput, r.rngsubtype, t.typtype, t.typbasetype
            FROM pg_type as t
            LEFT JOIN pg_range as r ON oid = rngtypid
           SQL else query = <<-SQL 
            SELECT t.oid, t.typname, t.typelem, t.typdelim, t.typinput, t.typtype, t.typbasetype
            FROM pg_type as t
           SQL end initializer = OID :: TypeMapInitializer . new ( type_map ) if oids query << ( "WHERE t.oid::integer IN (%s)" % oids . join ( ", " ) ) else if initializer . respond_to? ( :query_conditions_for_initial_load ) query << initializer . query_conditions_for_initial_load ( type_map ) end end records = execute ( query , 'SCHEMA' ) initializer . run ( records ) end
Support arrays/ranges for defining attributes that don't exist in the db
Support arrays / ranges for defining attributes that don ' t exist in the db
# query_conditions_for_initial_load only available since AR > 4.2.1
type_map
<not_specific>
oids
<not_specific>