Module: ActiveRecord::ConnectionAdapters::OracleEnhancedColumnDefinition

Defined in:
lib/active_record/connection_adapters/oracle_enhanced_schema_definitions.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object

:nodoc:



14
15
16
17
18
19
# File 'lib/active_record/connection_adapters/oracle_enhanced_schema_definitions.rb', line 14

def self.included(base) #:nodoc:
 base.class_eval do
   alias_method_chain :to_sql, :virtual_columns
   alias to_s :to_sql
 end
end

Instance Method Details

#lob?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/active_record/connection_adapters/oracle_enhanced_schema_definitions.rb', line 33

def lob?
  ['CLOB', 'BLOB'].include?(sql_type)
end

#to_sql_with_virtual_columnsObject



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/active_record/connection_adapters/oracle_enhanced_schema_definitions.rb', line 21

def to_sql_with_virtual_columns
  if type==:virtual
    column_sql = "#{base.quote_column_name(name)} AS (#{default})"
  else
    column_sql = to_sql_without_virtual_columns
    if type==:primary_key
      column_sql << base.table_definition_tablespace
    end
  end
  column_sql
end