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.



1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
# File 'lib/arjdbc/postgresql/adapter.rb', line 1224

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