Class: ActiveRecord::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/active_record/connection_adapters/oracle_enhanced_adapter.rb

Class Method Summary collapse

Class Method Details

.add_order_with_lobs!(sql, order, scope = :auto) ⇒ Object Also known as: add_order!

RSI: patch ORDER BY to work with LOBs



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/active_record/connection_adapters/oracle_enhanced_adapter.rb', line 83

def add_order_with_lobs!(sql, order, scope = :auto)
  if connection.is_a?(ConnectionAdapters::OracleEnhancedAdapter)
    order = connection.lob_order_by_expression(self, order) if order
    
    orig_scope = scope
    scope = scope(:find) if :auto == scope
    if scope
      new_scope_order = connection.lob_order_by_expression(self, scope[:order])
      if new_scope_order != scope[:order]
        scope = scope.merge(:order => new_scope_order)
      else
        scope = orig_scope
      end
    end
  end
  add_order_without_lobs!(sql, order, scope = :auto)
end

.ignore_table_columns(*args) ⇒ Object

RSI: specify table columns which should be ifnored



51
52
53
# File 'lib/active_record/connection_adapters/oracle_enhanced_adapter.rb', line 51

def self.ignore_table_columns(*args)
  connection.ignore_table_columns(table_name,*args)
end

.oracle_enhanced_connection(config) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/active_record/connection_adapters/oracle_enhanced_adapter.rb', line 37

def self.oracle_enhanced_connection(config)
  if config[:emulate_oracle_adapter] == true
    # allows the enhanced adapter to look like the OracleAdapter. Useful to pick up
    # conditionals in the rails activerecord test suite
    require 'active_record/connection_adapters/emulation/oracle_adapter'
    ConnectionAdapters::OracleAdapter.new(
      ConnectionAdapters::OracleEnhancedConnection.create(config), logger)
  else
    ConnectionAdapters::OracleEnhancedAdapter.new(
      ConnectionAdapters::OracleEnhancedConnection.create(config), logger)
  end
end

.set_boolean_columns(*args) ⇒ Object

RSI: specify which table columns should be treated as booleans



66
67
68
# File 'lib/active_record/connection_adapters/oracle_enhanced_adapter.rb', line 66

def self.set_boolean_columns(*args)
  connection.set_type_for_columns(table_name,:boolean,*args)
end

.set_date_columns(*args) ⇒ Object

RSI: specify which table columns should be treated as date (without time)



56
57
58
# File 'lib/active_record/connection_adapters/oracle_enhanced_adapter.rb', line 56

def self.set_date_columns(*args)
  connection.set_type_for_columns(table_name,:date,*args)
end

.set_datetime_columns(*args) ⇒ Object

RSI: specify which table columns should be treated as datetime



61
62
63
# File 'lib/active_record/connection_adapters/oracle_enhanced_adapter.rb', line 61

def self.set_datetime_columns(*args)
  connection.set_type_for_columns(table_name,:datetime,*args)
end

.table_commentObject

RSI: get table comment from schema definition



106
107
108
# File 'lib/active_record/connection_adapters/oracle_enhanced_adapter.rb', line 106

def self.table_comment
  connection.table_comment(self.table_name)
end