diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2006-03-01 16:01:53 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2006-03-01 16:01:53 +0000 |
commit | 631181ca18d2a21c3e72039b0c7f6c5a0b2fc05a (patch) | |
tree | 616eff996cee75f95695580660e31291038dca0d /activerecord/test | |
parent | 7056fc6782cba6dacccbba86cb231b58d8f5b4c8 (diff) | |
download | rails-631181ca18d2a21c3e72039b0c7f6c5a0b2fc05a.tar.gz rails-631181ca18d2a21c3e72039b0c7f6c5a0b2fc05a.tar.bz2 rails-631181ca18d2a21c3e72039b0c7f6c5a0b2fc05a.zip |
Renamed the "oci" adapter to "oracle", but kept the old name as an alias (closes #4017) [schoenm@earthlink.net]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3718 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test')
13 files changed, 25 insertions, 27 deletions
diff --git a/activerecord/test/base_test.rb b/activerecord/test/base_test.rb index 4cdf24c03d..114e3cbd9e 100755 --- a/activerecord/test/base_test.rb +++ b/activerecord/test/base_test.rb @@ -17,7 +17,7 @@ class MasterCreditCard < ActiveRecord::Base; end class Post < ActiveRecord::Base; end class Computer < ActiveRecord::Base; end class NonExistentTable < ActiveRecord::Base; end -class TestOCIDefault < ActiveRecord::Base; end +class TestOracleDefault < ActiveRecord::Base; end class LoosePerson < ActiveRecord::Base attr_protected :credit_rating, :administrator @@ -526,8 +526,8 @@ class BasicsTest < Test::Unit::TestCase # Oracle has some funky default handling, so it requires a bit of # extra testing. See ticket #2788. - if current_adapter?(:OCIAdapter) - test = TestOCIDefault.new + if current_adapter?(:OracleAdapter) + test = TestOracleDefault.new assert_equal "X", test.test_char assert_equal "hello", test.test_string assert_equal 3, test.test_int @@ -536,7 +536,7 @@ class BasicsTest < Test::Unit::TestCase def test_utc_as_time_zone # Oracle and SQLServer do not have a TIME datatype. - return true if current_adapter?(:SQLServerAdapter) || current_adapter?(:OCIAdapter) + return true if current_adapter?(:SQLServerAdapter) || current_adapter?(:OracleAdapter) Topic.default_timezone = :utc attributes = { "bonus_time" => "5:42:00AM" } @@ -704,7 +704,7 @@ class BasicsTest < Test::Unit::TestCase def test_attributes_on_dummy_time # Oracle and SQL Server do not have a TIME datatype. - return true if current_adapter?(:SQLServerAdapter) || current_adapter?(:OCIAdapter) + return true if current_adapter?(:SQLServerAdapter) || current_adapter?(:OracleAdapter) attributes = { "bonus_time" => "5:42:00AM" diff --git a/activerecord/test/binary_test.rb b/activerecord/test/binary_test.rb index 8ba758a892..e7a87a4833 100644 --- a/activerecord/test/binary_test.rb +++ b/activerecord/test/binary_test.rb @@ -20,7 +20,7 @@ class BinaryTest < Test::Unit::TestCase # Without using prepared statements, it makes no sense to test # BLOB data with DB2 or Firebird, because the length of a statement # is limited to 32KB. - unless %w(SQLServer DB2 OCI Firebird).include? ActiveRecord::Base.connection.adapter_name + unless %w(SQLServer DB2 Oracle Firebird).include? ActiveRecord::Base.connection.adapter_name def test_load_save bin = Binary.new bin.data = @data diff --git a/activerecord/test/column_alias_test.rb b/activerecord/test/column_alias_test.rb index 729a252eef..19526cf9b3 100644 --- a/activerecord/test/column_alias_test.rb +++ b/activerecord/test/column_alias_test.rb @@ -4,7 +4,7 @@ require 'fixtures/topic' class TestColumnAlias < Test::Unit::TestCase fixtures :topics - QUERY = if 'OCI' == ActiveRecord::Base.connection.adapter_name + QUERY = if 'Oracle' == ActiveRecord::Base.connection.adapter_name 'SELECT id AS pk FROM topics WHERE ROWNUM < 2' else 'SELECT id AS pk FROM topics' diff --git a/activerecord/test/connections/native_oci/connection.rb b/activerecord/test/connections/native_oracle/connection.rb index 0b1babb898..095fe9d5ee 100644 --- a/activerecord/test/connections/native_oci/connection.rb +++ b/activerecord/test/connections/native_oracle/connection.rb @@ -1,25 +1,23 @@ -print "Using OCI Oracle\n" +print "Using Oracle\n" require_dependency 'fixtures/course' require 'logger' ActiveRecord::Base.logger = Logger.new STDOUT ActiveRecord::Base.logger.level = Logger::WARN -db1 = 'activerecord_unittest' -db2 = 'activerecord_unittest2' +# Set these to your database connection strings +db = 'activerecord_unit_tests' ActiveRecord::Base.establish_connection( - :adapter => 'oci', - :host => '', # can use an oracle SID + :adapter => 'oracle', :username => 'arunit', :password => 'arunit', - :database => db1 + :database => db ) Course.establish_connection( - :adapter => 'oci', - :host => '', # can use an oracle SID + :adapter => 'oracle', :username => 'arunit2', :password => 'arunit2', - :database => db2 + :database => db ) diff --git a/activerecord/test/fixtures/db_definitions/create_oracle_db.sh b/activerecord/test/fixtures/db_definitions/create_oracle_db.sh deleted file mode 100644 index e69de29bb2..0000000000 --- a/activerecord/test/fixtures/db_definitions/create_oracle_db.sh +++ /dev/null diff --git a/activerecord/test/fixtures/db_definitions/oci.drop.sql b/activerecord/test/fixtures/db_definitions/oracle.drop.sql index 4d4ddb835d..4d4ddb835d 100644 --- a/activerecord/test/fixtures/db_definitions/oci.drop.sql +++ b/activerecord/test/fixtures/db_definitions/oracle.drop.sql diff --git a/activerecord/test/fixtures/db_definitions/oci.sql b/activerecord/test/fixtures/db_definitions/oracle.sql index 7ecbea29b0..39099b1747 100644 --- a/activerecord/test/fixtures/db_definitions/oci.sql +++ b/activerecord/test/fixtures/db_definitions/oracle.sql @@ -275,13 +275,13 @@ create table keyboards ( ); create sequence keyboards_seq minvalue 10000; -create table test_oci_defaults ( +create table test_oracle_defaults ( id integer not null primary key, test_char char(1) default 'X' not null, test_string varchar2(20) default 'hello' not null, test_int integer default 3 not null ); -create sequence test_oci_defaults_seq minvalue 10000; +create sequence test_oracle_defaults_seq minvalue 10000; --This table has an altered lock_version column name. create table legacy_things ( diff --git a/activerecord/test/fixtures/db_definitions/oci2.drop.sql b/activerecord/test/fixtures/db_definitions/oracle2.drop.sql index abe7e55c31..abe7e55c31 100644 --- a/activerecord/test/fixtures/db_definitions/oci2.drop.sql +++ b/activerecord/test/fixtures/db_definitions/oracle2.drop.sql diff --git a/activerecord/test/fixtures/db_definitions/oci2.sql b/activerecord/test/fixtures/db_definitions/oracle2.sql index 3c171f4f14..3c171f4f14 100644 --- a/activerecord/test/fixtures/db_definitions/oci2.sql +++ b/activerecord/test/fixtures/db_definitions/oracle2.sql diff --git a/activerecord/test/fixtures_test.rb b/activerecord/test/fixtures_test.rb index a57232e315..51f7109645 100755 --- a/activerecord/test/fixtures_test.rb +++ b/activerecord/test/fixtures_test.rb @@ -61,7 +61,7 @@ class FixturesTest < Test::Unit::TestCase t.column :written_on, :datetime t.column :bonus_time, :time t.column :last_read, :date - t.column :content, :text + t.column :content, :string t.column :approved, :boolean, :default => true t.column :replies_count, :integer, :default => 0 t.column :parent_id, :integer @@ -78,16 +78,16 @@ class FixturesTest < Test::Unit::TestCase topics = create_fixtures("topics") - # Restore prefix/suffix to its previous values - ActiveRecord::Base.table_name_prefix = old_prefix - ActiveRecord::Base.table_name_suffix = old_suffix - firstRow = ActiveRecord::Base.connection.select_one("SELECT * FROM prefix_topics_suffix WHERE author_name = 'David'") assert_equal("The First Topic", firstRow["title"]) secondRow = ActiveRecord::Base.connection.select_one("SELECT * FROM prefix_topics_suffix WHERE author_name = 'Mary'") assert_nil(secondRow["author_email_address"]) ensure + # Restore prefix/suffix to its previous values + ActiveRecord::Base.table_name_prefix = old_prefix + ActiveRecord::Base.table_name_suffix = old_suffix + ActiveRecord::Base.connection.drop_table :prefix_topics_suffix rescue nil end end diff --git a/activerecord/test/migration_test.rb b/activerecord/test/migration_test.rb index 8d8deb8026..4fec71d39f 100644 --- a/activerecord/test/migration_test.rb +++ b/activerecord/test/migration_test.rb @@ -84,7 +84,7 @@ if ActiveRecord::Base.connection.supports_migrations? four = columns.detect { |c| c.name == "four" } assert_equal "hello", one.default - if current_adapter?(:OCIAdapter) + if current_adapter?(:OracleAdapter) # Oracle doesn't support native booleans assert_equal true, two.default == 1 assert_equal false, three.default != 0 @@ -153,7 +153,7 @@ if ActiveRecord::Base.connection.supports_migrations? assert_equal Fixnum, bob.age.class assert_equal Time, bob.birthday.class - if current_adapter?(:SQLServerAdapter) or current_adapter?(:OCIAdapter) + if current_adapter?(:SQLServerAdapter) or current_adapter?(:OracleAdapter) # SQL Server and Oracle don't differentiate between date/time assert_equal Time, bob.favorite_day.class else @@ -241,7 +241,7 @@ if ActiveRecord::Base.connection.supports_migrations? ActiveRecord::Base.connection.rename_table :octopuses, :octopi assert_nothing_raised do - if current_adapter?(:OCIAdapter) + if current_adapter?(:OracleAdapter) # Oracle requires the explicit sequence for the pk ActiveRecord::Base.connection.execute "INSERT INTO octopi (id, url) VALUES (octopi_seq.nextval, 'http://www.foreverflying.com/octopus-black7.jpg')" else diff --git a/activerecord/test/readonly_test.rb b/activerecord/test/readonly_test.rb index bd9b8ef1b7..55f5cbe4ca 100755 --- a/activerecord/test/readonly_test.rb +++ b/activerecord/test/readonly_test.rb @@ -79,7 +79,7 @@ class ReadOnlyTest < Test::Unit::TestCase # Oracle barfs on this because the join includes unqualified and # conflicting column names - unless current_adapter?(:OCIAdapter) + unless current_adapter?(:OracleAdapter) Post.with_scope(:find => { :joins => ', developers' }) do assert Post.find(1).readonly? assert Post.find(1, :readonly => true).readonly? diff --git a/activerecord/test/synonym_test_oci.rb b/activerecord/test/synonym_test_oracle.rb index fcfb2f3bd1..fcfb2f3bd1 100644 --- a/activerecord/test/synonym_test_oci.rb +++ b/activerecord/test/synonym_test_oracle.rb |