Class: ActiveRecord::ConnectionAdapters::PostgreSQLColumn

Inherits:
JdbcColumn
  • Object
show all
Includes:
ArJdbc::PostgreSQL::Column
Defined in:
lib/arjdbc/postgresql/adapter.rb

Instance Attribute Summary

Attributes inherited from JdbcColumn

#limit, #precision

Instance Method Summary collapse

Methods included from ArJdbc::PostgreSQL::Column

#default_value, #extract_bounds, #infinity, #to_integer, #type_cast

Methods inherited from JdbcColumn

column_types, #default_value, #init_column

Constructor Details

#initialize(name, default, oid_type = nil, sql_type = nil, null = true) ⇒ PostgreSQLColumn

Returns a new instance of PostgreSQLColumn.



1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
# File 'lib/arjdbc/postgresql/adapter.rb', line 1240

def initialize(name, default, oid_type = nil, sql_type = nil, null = true)
  if oid_type.is_a?(Integer) then @oid_type = oid_type
  else # NOTE: AR <= 3.2 : (name, default, sql_type = nil, null = true)
    null, sql_type, oid_type = !! sql_type, oid_type, nil
  end
  if sql_type =~ /\[\]$/ && ArJdbc::PostgreSQL::AR4_COMPAT
    @array = true if respond_to?(:array)
    super(name, default, sql_type[0..sql_type.length - 3], null)
  else
    @array = false if respond_to?(:array)
    super(name, default, sql_type, null)
  end

  @default_function = default if has_default_function?(@default, default)
end