Class: ActiveRecord::ConnectionAdapters::PostgreSQLColumn

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

Instance Attribute Summary

Attributes included from ArJdbc::PostgreSQL::Column

#array

Attributes inherited from JdbcColumn

#limit, #precision

Instance Method Summary collapse

Methods included from ArJdbc::PostgreSQL::Column

#array?, #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.



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

def initialize(name, default, oid_type = nil, sql_type = nil, null = true)
  # NOTE: we support AR <= 3.2 : (name, default, sql_type = nil, null = true)
  null, sql_type, oid_type = !! sql_type, oid_type, nil unless oid_type.is_a?(Integer)
  @oid_type = oid_type
  if sql_type =~ /\[\]$/
    @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
end