From 10d458b0aadc9f44bfadda6e59d08be8ea661029 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Wed, 23 Feb 2005 13:34:57 +0000 Subject: Added a OCI8-based Oracle adapter that has been verified to work with Oracle 8 and 9 #629 [Graham Jenkins]. Removed Maiks Oracle adapter until it can be merged with the OCI one. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@761 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- .../test/connections/native_oci/connection.rb | 25 +++ .../test/connections/native_oracle/connection.rb | 24 --- .../test/fixtures/db_definitions/oci.drop.sql | 18 +++ activerecord/test/fixtures/db_definitions/oci.sql | 167 +++++++++++++++++++++ .../test/fixtures/db_definitions/oci2.drop.sql | 2 + activerecord/test/fixtures/db_definitions/oci2.sql | 6 + .../test/fixtures/db_definitions/oracle.sql | 149 ------------------ .../test/fixtures/db_definitions/oracle2.sql | 7 - 8 files changed, 218 insertions(+), 180 deletions(-) create mode 100644 activerecord/test/connections/native_oci/connection.rb delete mode 100644 activerecord/test/connections/native_oracle/connection.rb create mode 100644 activerecord/test/fixtures/db_definitions/oci.drop.sql create mode 100644 activerecord/test/fixtures/db_definitions/oci.sql create mode 100644 activerecord/test/fixtures/db_definitions/oci2.drop.sql create mode 100644 activerecord/test/fixtures/db_definitions/oci2.sql delete mode 100644 activerecord/test/fixtures/db_definitions/oracle.sql delete mode 100644 activerecord/test/fixtures/db_definitions/oracle2.sql (limited to 'activerecord/test') diff --git a/activerecord/test/connections/native_oci/connection.rb b/activerecord/test/connections/native_oci/connection.rb new file mode 100644 index 0000000000..2d9006c231 --- /dev/null +++ b/activerecord/test/connections/native_oci/connection.rb @@ -0,0 +1,25 @@ +print "Using OCI Oracle\n" +require 'fixtures/course' +require 'logger' + +ActiveRecord::Base.logger = Logger.new STDOUT +ActiveRecord::Base.logger.level = Logger::WARN + +db1 = 'activerecord_unittest' +db2 = 'activerecord_unittest2' + +ActiveRecord::Base.establish_connection( + :adapter => 'oci', + :host => '', # can use an oracle SID + :username => 'arunit', + :password => 'arunit', + :database => db1 +) + +Course.establish_connection( + :adapter => 'oci', + :host => '', # can use an oracle SID + :username => 'arunit2', + :password => 'arunit2', + :database => db2 +) diff --git a/activerecord/test/connections/native_oracle/connection.rb b/activerecord/test/connections/native_oracle/connection.rb deleted file mode 100644 index 7e4cc5b574..0000000000 --- a/activerecord/test/connections/native_oracle/connection.rb +++ /dev/null @@ -1,24 +0,0 @@ -print "Using native Oracle\n" -require 'fixtures/course' -require 'logger' - -ActiveRecord::Base.logger = Logger.new("debug.log") - -db1 = 'local' -db2 = 'local' - -ActiveRecord::Base.establish_connection( - :adapter => "oracle", - :host => "localhost", - :username => "arunit", - :password => "arunit", - :database => db1 -) - -Course.establish_connection( - :adapter => "oracle", - :host => "localhost", - :username => "arunit2", - :password => "arunit2", - :database => db2 -) diff --git a/activerecord/test/fixtures/db_definitions/oci.drop.sql b/activerecord/test/fixtures/db_definitions/oci.drop.sql new file mode 100644 index 0000000000..255e024531 --- /dev/null +++ b/activerecord/test/fixtures/db_definitions/oci.drop.sql @@ -0,0 +1,18 @@ +drop table accounts; +drop table companies; +drop table topics; +drop table developers; +drop table projects; +drop table developers_projects; +drop table customers; +drop table movies; +drop table subscribers; +drop table booleantests; +drop table auto_id_tests; +drop table entrants; +drop table colnametests; +drop table mixins; +drop table people; +drop table binaries; +drop table computers; +drop sequence rails_sequence; diff --git a/activerecord/test/fixtures/db_definitions/oci.sql b/activerecord/test/fixtures/db_definitions/oci.sql new file mode 100644 index 0000000000..86d7a03165 --- /dev/null +++ b/activerecord/test/fixtures/db_definitions/oci.sql @@ -0,0 +1,167 @@ +create sequence rails_sequence minvalue 10000; + +create table companies ( + id integer not null, + type varchar(50) default null, + ruby_type varchar(50) default null, + firm_id integer default null references companies initially deferred disable, + name varchar(50) default null, + client_of integer default null references companies initially deferred disable, + companies_count integer default 0, + rating integer default 1, + primary key (id) +); + +create table accounts ( + id integer not null, + firm_id integer default null references companies initially deferred disable, + credit_limit integer default null, + primary key (id) +); + +create table topics ( + id integer not null, + title varchar(255) default null, + author_name varchar(255) default null, + author_email_address varchar(255) default null, + written_on timestamp default null, + bonus_time timestamp default null, + last_read timestamp default null, + content varchar(4000), + approved integer default 1, + replies_count integer default 0, + parent_id integer references topics initially deferred disable, + type varchar(50) default null, + primary key (id) +); +-- try again for 8i +create table topics ( + id integer not null, + title varchar(255) default null, + author_name varchar(255) default null, + author_email_address varchar(255) default null, + written_on date default null, + bonus_time date default null, + last_read date default null, + content varchar(4000), + approved integer default 1, + replies_count integer default 0, + parent_id integer references topics initially deferred disable, + type varchar(50) default null, + primary key (id) +); + +create table developers ( + id integer not null, + name varchar(100) default null, + salary integer default 70000, + primary key (id) +); + +create table projects ( + id integer not null, + name varchar(100) default null, + primary key (id) +); + +create table developers_projects ( + developer_id integer not null references developers initially deferred disable, + project_id integer not null references projects initially deferred disable, + joined_on timestamp default null +); +-- Try again for 8i +create table developers_projects ( + developer_id integer not null references developers initially deferred disable, + project_id integer not null references projects initially deferred disable, + joined_on date default null +); + +create table customers ( + id integer not null, + name varchar(100) default null, + balance integer default 0, + address_street varchar(100) default null, + address_city varchar(100) default null, + address_country varchar(100) default null, + primary key (id) +); + +create table movies ( + movieid integer not null, + name varchar(100) default null, + primary key (movieid) +); + +create table subscribers ( + nick varchar(100) not null, + name varchar(100) default null, + primary key (nick) +); + +create table booleantests ( + id integer not null, + value integer default null, + primary key (id) +); + +create table auto_id_tests ( + auto_id integer not null, + value integer default null, + primary key (auto_id) +); + +create table entrants ( + id integer not null primary key, + name varchar(255) not null, + course_id integer not null +); + +create table colnametests ( + id integer not null, + references integer not null, + primary key (id) +); + +create table mixins ( + id integer not null, + parent_id integer default null references mixins initially deferred disable, + type varchar(40) default null, + pos integer default null, + lft integer default null, + rgt integer default null, + root_id integer default null, + created_at timestamp default null, + updated_at timestamp default null, + primary key (id) +); +-- try again for 8i +create table mixins ( + id integer not null, + parent_id integer default null references mixins initially deferred disable, + type varchar(40) default null, + pos integer default null, + lft integer default null, + rgt integer default null, + root_id integer default null, + created_at date default null, + updated_at date default null, + primary key (id) +); + +create table people ( + id integer not null, + first_name varchar(40) null, + lock_version integer default 0, + primary key (id) +); + +create table binaries ( + id integer not null, + data blob null, + primary key (id) +); + +create table computers ( + id integer not null primary key, + developer integer not null references developers initially deferred disable +); diff --git a/activerecord/test/fixtures/db_definitions/oci2.drop.sql b/activerecord/test/fixtures/db_definitions/oci2.drop.sql new file mode 100644 index 0000000000..7277a52552 --- /dev/null +++ b/activerecord/test/fixtures/db_definitions/oci2.drop.sql @@ -0,0 +1,2 @@ +drop table courses; +drop sequence rails_sequence; diff --git a/activerecord/test/fixtures/db_definitions/oci2.sql b/activerecord/test/fixtures/db_definitions/oci2.sql new file mode 100644 index 0000000000..5ac62b0062 --- /dev/null +++ b/activerecord/test/fixtures/db_definitions/oci2.sql @@ -0,0 +1,6 @@ +create sequence rails_sequence minvalue 10000; + +create table courses ( + id int not null primary key, + name varchar(255) not null +); diff --git a/activerecord/test/fixtures/db_definitions/oracle.sql b/activerecord/test/fixtures/db_definitions/oracle.sql deleted file mode 100644 index 31e66e8532..0000000000 --- a/activerecord/test/fixtures/db_definitions/oracle.sql +++ /dev/null @@ -1,149 +0,0 @@ -CREATE TABLE accounts ( - id int NOT NULL, - firm_id int default NULL, - credit_limit int default NULL, - PRIMARY KEY (id) -); -CREATE SEQUENCE accounts_id MINVALUE 10000; - -CREATE TABLE companies ( - id int NOT NULL, - type varchar(50) default NULL, - ruby_type varchar(50) default NULL, - firm_id int default NULL, - name varchar(50) default NULL, - client_of int default NULL, - rating int default 1, - PRIMARY KEY (id) -); -CREATE SEQUENCE companies_id MINVALUE 10000; - -CREATE TABLE topics ( - id int NOT NULL, - title varchar(255) default NULL, - author_name varchar(255) default NULL, - author_email_address varchar(255) default NULL, - written_on timestamp default NULL, - bonus_time timestamp default NULL, - last_read date default NULL, - content varchar(3000), - approved smallint default 1, - replies_count int default 0, - parent_id int default NULL, - type varchar(50) default NULL, - PRIMARY KEY (id) -); -CREATE SEQUENCE topics_id MINVALUE 10000; - -CREATE TABLE developers ( - id int NOT NULL, - name varchar(100) default NULL, - salary int default 70000, - PRIMARY KEY (id) -); -CREATE SEQUENCE developers_id MINVALUE 10000; - -CREATE TABLE projects ( - id int NOT NULL, - name varchar(100) default NULL, - PRIMARY KEY (id) -); -CREATE SEQUENCE projects_id MINVALUE 10000; - -CREATE TABLE developers_projects ( - developer_id int NOT NULL, - project_id int NOT NULL, - joined_on date default NULL -); -CREATE SEQUENCE developers_projects_id MINVALUE 10000; - -CREATE TABLE customers ( - id int NOT NULL, - name varchar(100) default NULL, - balance int default 0, - address_street varchar(100) default NULL, - address_city varchar(100) default NULL, - address_country varchar(100) default NULL, - PRIMARY KEY (id) -); -CREATE SEQUENCE customers_id MINVALUE 10000; - -CREATE TABLE movies ( - movieid int NOT NULL, - name varchar(100) default NULL, - PRIMARY KEY (movieid) -); -CREATE SEQUENCE movies_id MINVALUE 10000; - -CREATE TABLE subscribers ( - nick varchar(100) NOT NULL, - name varchar(100) default NULL, - PRIMARY KEY (nick) -); -CREATE SEQUENCE subscribers_id MINVALUE 10000; - -CREATE TABLE booleantests ( - id int NOT NULL, - value int default NULL, - PRIMARY KEY (id) -); -CREATE SEQUENCE booleantests_id MINVALUE 10000; - -CREATE TABLE auto_id_tests ( - auto_id int NOT NULL, - value int default NULL, - PRIMARY KEY (auto_id) -); -CREATE SEQUENCE auto_id_tests_id MINVALUE 10000; - -CREATE TABLE entrants ( - id int NOT NULL PRIMARY KEY, - name varchar(255) NOT NULL, - course_id int NOT NULL -); -CREATE SEQUENCE entrants_id MINVALUE 10000; - -CREATE TABLE colnametests ( - id int NOT NULL, - references int NOT NULL, - PRIMARY KEY (id) -); -CREATE SEQUENCE colnametests_id MINVALUE 10000; - -CREATE TABLE mixins ( - id int NOT NULL, - parent_id int default NULL, - pos int default NULL, - created_at timestamp default NULL, - updated_at timestamp default NULL, - lft int default NULL, - rgt int default NULL, - root_id int default NULL, - type varchar(40) default NULL, - PRIMARY KEY (id) -); -CREATE SEQUENCE mixins_id MINVALUE 10000; - -CREATE TABLE people ( - id int NOT NULL, - first_name varchar(40) NOT NULL, - lock_version int default 0, - PRIMARY KEY (id) -); -CREATE SEQUENCE people_id MINVALUE 10000; - -CREATE TABLE binaries ( - id int NOT NULL, - data blob, - PRIMARY KEY (id) -); -CREATE SEQUENCE binaries_id MINVALUE 10000; - -CREATE TABLE computers ( - id int, - developer int NOT NULL, - PRIMARY KEY (id) -); -CREATE SEQUENCE computers_id MINVALUE 10000; - -EXIT; diff --git a/activerecord/test/fixtures/db_definitions/oracle2.sql b/activerecord/test/fixtures/db_definitions/oracle2.sql deleted file mode 100644 index e0bfde022c..0000000000 --- a/activerecord/test/fixtures/db_definitions/oracle2.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE TABLE courses ( - id int NOT NULL PRIMARY KEY, - name varchar(255) NOT NULL -); -CREATE SEQUENCE courses_id MINVALUE 10000; - -EXIT; -- cgit v1.2.3