Class: ActiveRecord::Base
- Inherits:
-
Object
- Object
- ActiveRecord::Base
- Defined in:
- lib/active_record/connection_adapters/oracle_enhanced_adapter.rb
Class Method Summary collapse
-
.add_order_with_lobs!(sql, order, scope = :auto) ⇒ Object
(also: add_order!)
patch ORDER BY to work with LOBs.
-
.ignore_table_columns(*args) ⇒ Object
Specify table columns which should be ignored by ActiveRecord.
-
.oracle_enhanced_connection(config) ⇒ Object
Establishes a connection to the database that’s used by all Active Record objects.
-
.set_boolean_columns(*args) ⇒ Object
Specify which table columns should be typecasted to boolean values
true
orfalse
. -
.set_date_columns(*args) ⇒ Object
Specify which table columns should be typecasted to Date (without time).
-
.set_datetime_columns(*args) ⇒ Object
Specify which table columns should be typecasted to Time (or DateTime).
-
.table_comment ⇒ Object
Get table comment from schema definition.
Class Method Details
.add_order_with_lobs!(sql, order, scope = :auto) ⇒ Object Also known as: add_order!
patch ORDER BY to work with LOBs
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/active_record/connection_adapters/oracle_enhanced_adapter.rb', line 84 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
Specify table columns which should be ignored by ActiveRecord.
52 53 54 |
# File 'lib/active_record/connection_adapters/oracle_enhanced_adapter.rb', line 52 def self.ignore_table_columns(*args) connection.ignore_table_columns(table_name,*args) end |
.oracle_enhanced_connection(config) ⇒ Object
Establishes a connection to the database that’s used by all Active Record objects.
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/active_record/connection_adapters/oracle_enhanced_adapter.rb', line 38 def self.oracle_enhanced_connection(config) #:nodoc: 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
Specify which table columns should be typecasted to boolean values true
or false
.
67 68 69 |
# File 'lib/active_record/connection_adapters/oracle_enhanced_adapter.rb', line 67 def self.set_boolean_columns(*args) connection.set_type_for_columns(table_name,:boolean,*args) end |
.set_date_columns(*args) ⇒ Object
Specify which table columns should be typecasted to Date (without time).
57 58 59 |
# File 'lib/active_record/connection_adapters/oracle_enhanced_adapter.rb', line 57 def self.set_date_columns(*args) connection.set_type_for_columns(table_name,:date,*args) end |
.set_datetime_columns(*args) ⇒ Object
Specify which table columns should be typecasted to Time (or DateTime).
62 63 64 |
# File 'lib/active_record/connection_adapters/oracle_enhanced_adapter.rb', line 62 def self.set_datetime_columns(*args) connection.set_type_for_columns(table_name,:datetime,*args) end |
.table_comment ⇒ Object
Get table comment from schema definition.
109 110 111 |
# File 'lib/active_record/connection_adapters/oracle_enhanced_adapter.rb', line 109 def self.table_comment connection.table_comment(self.table_name) end |