| 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 233
233: def active?
234: # Pings the connection to check if it's still good. Note that an
235: # #active? method is also available, but that simply returns the
236: # last known state, which isn't good enough if the connection has
237: # gone stale since the last use.
238: @connection.ping
239: rescue OCIException
240: false
241: end
Disconnects from the database.
# File vendor/rails/activerecord/lib/active_record/connection_adapters/oracle_adapter.rb, line 251
251: def disconnect!
252: @connection.logoff rescue nil
253: @connection.active = false
254: end
# File vendor/rails/activerecord/lib/active_record/connection_adapters/oracle_adapter.rb, line 178
178: def native_database_types #:nodoc
179: {
180: :primary_key => "NUMBER(38) NOT NULL PRIMARY KEY",
181: :string => { :name => "VARCHAR2", :limit => 255 },
182: :text => { :name => "CLOB" },
183: :integer => { :name => "NUMBER", :limit => 38 },
184: :float => { :name => "NUMBER" },
185: :datetime => { :name => "DATE" },
186: :timestamp => { :name => "DATE" },
187: :time => { :name => "DATE" },
188: :date => { :name => "DATE" },
189: :binary => { :name => "BLOB" },
190: :boolean => { :name => "NUMBER", :limit => 1 }
191: }
192: end
Reconnects to the database.
# File vendor/rails/activerecord/lib/active_record/connection_adapters/oracle_adapter.rb, line 244
244: def reconnect!
245: @connection.reset!
246: rescue OCIException => e
247: @logger.warn "#{adapter_name} automatic reconnection failed: #{e.message}"
248: end