Class: ActiveRecord::ConnectionAdapters::PostgreSQLColumn
- Inherits:
-
JdbcColumn
- Object
- Column
- JdbcColumn
- ActiveRecord::ConnectionAdapters::PostgreSQLColumn
- Includes:
- ArJdbc::PostgreSQL::Column
- Defined in:
- lib/arjdbc/postgresql/adapter.rb
Instance Attribute Summary
Attributes inherited from JdbcColumn
Instance Method Summary collapse
-
#initialize(name, default, oid_type = nil, sql_type = nil, null = true, fmod = nil, adapter = nil) ⇒ PostgreSQLColumn
constructor
A new instance of PostgreSQLColumn.
Methods included from ArJdbc::PostgreSQL::Column
#accessor, #default_value, #extract_bounds, #infinity, #number?, #text?, #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, fmod = nil, adapter = nil) ⇒ PostgreSQLColumn
Returns a new instance of PostgreSQLColumn.
1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 |
# File 'lib/arjdbc/postgresql/adapter.rb', line 1275 def initialize(name, default, oid_type = nil, sql_type = nil, null = true, fmod = nil, adapter = nil) # added due resolving #oid_type if oid_type.is_a?(Integer) # the "main" if branch (on AR 4.x) @oid = oid_type; @fmod = fmod; @adapter = adapter # see Column#oid_type elsif oid_type.respond_to?(:type_cast) # MRI compatibility @oid_type = oid_type; # @fmod = fmod; @adapter = adapter 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.to_s[-2, 2] == '[]' && ArJdbc::PostgreSQL::AR4_COMPAT @array = true if respond_to?(:array) super(name, default, sql_type[0..-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 |