Class | ActiveRecord::ConnectionAdapters::OracleAdapter |
In: |
vendor/rails/activerecord/lib/active_record/connection_adapters/oracle_adapter.rb
|
Parent: | AbstractAdapter |
This is an Oracle/OCI adapter for the ActiveRecord persistence framework. It relies upon the OCI8 driver, which works with Oracle 8i and above. Most recent development has been on Debian Linux against a 10g database, ActiveRecord 1.12.1 and OCI8 0.1.13. See: rubyforge.org/projects/ruby-oci8/
Usage notes:
Required parameters:
execute | -> | update |
execute | -> | delete |
Returns true if the connection is active.
# File vendor/rails/activerecord/lib/active_record/connection_adapters/oracle_adapter.rb, line 205 205: def active? 206: # Pings the connection to check if it's still good. Note that an 207: # #active? method is also available, but that simply returns the 208: # last known state, which isn't good enough if the connection has 209: # gone stale since the last use. 210: @connection.ping 211: rescue OCIException 212: false 213: end
Disconnects from the database.
# File vendor/rails/activerecord/lib/active_record/connection_adapters/oracle_adapter.rb, line 223 223: def disconnect! 224: @connection.logoff rescue nil 225: @connection.active = false 226: end
# File vendor/rails/activerecord/lib/active_record/connection_adapters/oracle_adapter.rb, line 149 149: def native_database_types #:nodoc 150: { 151: :primary_key => "NUMBER(38) NOT NULL PRIMARY KEY", 152: :string => { :name => "VARCHAR2", :limit => 255 }, 153: :text => { :name => "CLOB" }, 154: :integer => { :name => "NUMBER", :limit => 38 }, 155: :float => { :name => "NUMBER" }, 156: :decimal => { :name => "DECIMAL" }, 157: :datetime => { :name => "DATE" }, 158: :timestamp => { :name => "DATE" }, 159: :time => { :name => "DATE" }, 160: :date => { :name => "DATE" }, 161: :binary => { :name => "BLOB" }, 162: :boolean => { :name => "NUMBER", :limit => 1 } 163: } 164: end
# File vendor/rails/activerecord/lib/active_record/connection_adapters/oracle_adapter.rb, line 196 196: def quoted_false 197: "0" 198: end
# File vendor/rails/activerecord/lib/active_record/connection_adapters/oracle_adapter.rb, line 192 192: def quoted_true 193: "1" 194: end
Reconnects to the database.
# File vendor/rails/activerecord/lib/active_record/connection_adapters/oracle_adapter.rb, line 216 216: def reconnect! 217: @connection.reset! 218: rescue OCIException => e 219: @logger.warn "#{adapter_name} automatic reconnection failed: #{e.message}" 220: end