Class | ActiveRecord::ConnectionAdapters::OracleAdapter
In: | 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:

- Key generation assumes a "${table_name}_seq" sequence is available for all tables; the sequence name can be changed using ActiveRecord::Base.set_sequence_name. When using Migrations, these sequences are created automatically.
- Oracle uses DATE or TIMESTAMP datatypes for both dates and times. Consequently some hacks are employed to map data back to Date or Time in Ruby. If the column_name ends in _time it‘s created as a Ruby Time. Else if the hours/minutes/seconds are 0, I make it a Ruby Date. Else it‘s a Ruby Time. This is a bit nasty - but if you use Duck Typing you‘ll probably not care very much. In 9i and up it‘s tempting to map DATE to Date and TIMESTAMP to Time, but too many databases use DATE for both. Timezones and sub-second precision on timestamps are not supported.
- Default values that are functions (such as "SYSDATE") are not supported. This is a restriction of the way ActiveRecord supports default values.
- Support for Oracle8 is limited by Rails’ use of ANSI join syntax, which is supported in Oracle9i and later. You will need to use finder_sql for has_and_belongs_to_many associations to run against Oracle8.

Required parameters:

- `:username`
- `:password`
- `:database`

### Methods

active? add_order_by_for_association_limiting! disconnect! distinct next_sequence_value pk_and_sequence_for prefetch_primary_key? quoted_false quoted_true reconnect! table_alias_length

### Public Instance methods

active?()

Returns true if the connection is active.

add_order_by_for_association_limiting!(sql, options)

ORDER BY clause for the passed order option.

Uses column aliases as defined by distinct.

disconnect!()

Disconnects from the database.

distinct(columns, order_by)

SELECT DISTINCT clause for a given set of columns and a given ORDER BY clause.

Oracle requires the ORDER BY columns to be in the SELECT list for DISTINCT queries. However, with those columns included in the SELECT DISTINCT list, you won‘t actually get a distinct list of the column you want (presuming the column has duplicates with multiple values for the ordered-by columns. So we use the FIRST_VALUE function to get a single (first) value for each column, effectively making every row the same.

      distinct("posts.id", "posts.created_at desc")

next_sequence_value(sequence_name)

Returns the next sequence value from a sequence generator. Not generally called directly; used by ActiveRecord to get the next primary key value when inserting a new database record (see prefetch_primary_key?).

pk_and_sequence_for(table_name)

Find a table‘s primary key and sequence. Note: Only primary key is implemented - sequence will be nil.

prefetch_primary_key?(table_name = nil)

Returns true for Oracle adapter (since Oracle requires primary key values to be pre-fetched before insert). See also next_sequence_value.

quoted_false()
quoted_true()
reconnect!()

Reconnects to the database.

table_alias_length()

[Validate]