Class ActiveRecord::ConnectionAdapters::OCIAdapter
In: lib/active_record/connection_adapters/oci_adapter.rb
Parent: AbstractAdapter

This is an Oracle adapter for the ActiveRecord persistence framework. It relies upon the OCI8 driver (rubyforge.org/projects/ruby-oci8/), which works with Oracle 8i and above. It was developed on Windows 2000 against an 8i database, using ActiveRecord 1.6.0 and OCI8 0.1.9. It has also been tested against a 9i database.

Usage notes:

  • Key generation uses a sequence "rails_sequence" for all tables. (I couldn’t find a simple and safe way of passing table-specific sequence information to the adapter.)
  • Oracle uses DATE or TIMESTAMP datatypes for both dates and times. Consequently I have had to resort to some hacks to get data converted 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 nasty - but if you use Duck Typing you’ll probably not care very much. In 9i it’s tempting to map DATE to Date and TIMESTAMP to Time but I don’t think that is valid - 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 active record supports default values.
  • Referential integrity constraints are not fully supported. Under at least some circumstances, active record appears to delete parent and child records out of sequence and out of transaction scope. (Or this may just be a problem of test setup.)

Options:

  • :username — Defaults to root
  • :password — Defaults to nothing
  • :host — Defaults to localhost

Methods

Public Instance methods

delete(sql, name = nil)

Alias for execute

update(sql, name = nil)

Alias for execute

[Validate]