Class: ActiveRecord::ConnectionAdapters::OracleColumn
- Defined in:
- lib/connection_adapters/oracle_adapter.rb
Instance Attribute Summary collapse
-
#default_spceified ⇒ Object
Returns the value of attribute default_spceified.
-
#primary_key ⇒ Object
Returns the value of attribute primary_key.
Instance Method Summary collapse
- #default_specified? ⇒ Boolean
-
#generated? ⇒ Boolean
The only means that Oracle currently provides for auto-generating a column is to define a sequence and a trigger on insert that inserts sequence.nextval.
-
#initialize(name, default, sql_type = nil, null = true) ⇒ OracleColumn
constructor
A new instance of OracleColumn.
Constructor Details
#initialize(name, default, sql_type = nil, null = true) ⇒ OracleColumn
Returns a new instance of OracleColumn.
9 10 11 12 |
# File 'lib/connection_adapters/oracle_adapter.rb', line 9 def initialize(name, default, sql_type = nil, null = true) if !(default.nil? || default.blank?) then @default_specified = true end super(name, default, sql_type, null) end |
Instance Attribute Details
#default_spceified ⇒ Object
Returns the value of attribute default_spceified.
7 8 9 |
# File 'lib/connection_adapters/oracle_adapter.rb', line 7 def default_spceified @default_spceified end |
#primary_key ⇒ Object
Returns the value of attribute primary_key.
7 8 9 |
# File 'lib/connection_adapters/oracle_adapter.rb', line 7 def primary_key @primary_key end |
Instance Method Details
#default_specified? ⇒ Boolean
15 16 17 |
# File 'lib/connection_adapters/oracle_adapter.rb', line 15 def default_specified? @default_specified end |
#generated? ⇒ Boolean
The only means that Oracle currently provides for auto-generating a column is to define a sequence and a trigger on insert that inserts sequence.nextval
As a result of this, there is no reliable way to determine whether a particular column is generated by the DB.
DrySQL currently makes the assumption that a column is auto-generated if the column is of type integer and is the primary key for the table
Ideally a future release of Oracle will support declaring a default value of sequence.nextval for a column, which will eliminate this problem.
30 31 32 |
# File 'lib/connection_adapters/oracle_adapter.rb', line 30 def generated? @type == :integer && @primary_key == true end |