activerecord-oracle_enhanced-adapter 1.7.11 → 1.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.md +206 -4
- data/README.md +37 -1
- data/VERSION +1 -1
- data/lib/active_record/connection_adapters/emulation/oracle_adapter.rb +1 -1
- data/lib/active_record/connection_adapters/oracle_enhanced/column.rb +7 -59
- data/lib/active_record/connection_adapters/oracle_enhanced/column_dumper.rb +6 -50
- data/lib/active_record/connection_adapters/oracle_enhanced/connection.rb +11 -11
- data/lib/active_record/connection_adapters/oracle_enhanced/context_index.rb +117 -117
- data/lib/active_record/connection_adapters/oracle_enhanced/database_statements.rb +37 -27
- data/lib/active_record/connection_adapters/oracle_enhanced/database_tasks.rb +10 -10
- data/lib/active_record/connection_adapters/oracle_enhanced/jdbc_connection.rb +56 -71
- data/lib/active_record/connection_adapters/oracle_enhanced/jdbc_quoting.rb +0 -7
- data/lib/active_record/connection_adapters/oracle_enhanced/oci_connection.rb +51 -69
- data/lib/active_record/connection_adapters/oracle_enhanced/oci_quoting.rb +4 -4
- data/lib/active_record/connection_adapters/oracle_enhanced/procedures.rb +76 -76
- data/lib/active_record/connection_adapters/oracle_enhanced/quoting.rb +14 -43
- data/lib/active_record/connection_adapters/oracle_enhanced/schema_creation.rb +60 -64
- data/lib/active_record/connection_adapters/oracle_enhanced/schema_definitions.rb +33 -47
- data/lib/active_record/connection_adapters/oracle_enhanced/schema_dumper.rb +150 -160
- data/lib/active_record/connection_adapters/oracle_enhanced/schema_statements.rb +95 -133
- data/lib/active_record/connection_adapters/oracle_enhanced/schema_statements_ext.rb +3 -3
- data/lib/active_record/connection_adapters/oracle_enhanced/structure_dump.rb +66 -101
- data/lib/active_record/connection_adapters/oracle_enhanced/version.rb +1 -1
- data/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb +290 -533
- data/lib/active_record/oracle_enhanced/type/boolean.rb +7 -10
- data/lib/active_record/oracle_enhanced/type/integer.rb +3 -4
- data/lib/active_record/oracle_enhanced/type/json.rb +8 -0
- data/lib/active_record/oracle_enhanced/type/national_character_string.rb +1 -1
- data/lib/active_record/oracle_enhanced/type/raw.rb +2 -3
- data/lib/active_record/oracle_enhanced/type/string.rb +2 -2
- data/lib/active_record/oracle_enhanced/type/text.rb +2 -2
- data/lib/active_record/oracle_enhanced/type/timestamptz.rb +23 -0
- data/lib/activerecord-oracle_enhanced-adapter.rb +2 -2
- data/spec/active_record/connection_adapters/oracle_enhanced_adapter_spec.rb +55 -162
- data/spec/active_record/connection_adapters/oracle_enhanced_connection_spec.rb +32 -34
- data/spec/active_record/connection_adapters/oracle_enhanced_context_index_spec.rb +44 -42
- data/spec/active_record/connection_adapters/oracle_enhanced_data_types_spec.rb +250 -357
- data/spec/active_record/connection_adapters/oracle_enhanced_database_tasks_spec.rb +14 -6
- data/spec/active_record/connection_adapters/oracle_enhanced_dbms_output_spec.rb +3 -5
- data/spec/active_record/connection_adapters/oracle_enhanced_dirty_spec.rb +115 -124
- data/spec/active_record/connection_adapters/oracle_enhanced_emulate_oracle_adapter_spec.rb +2 -3
- data/spec/active_record/connection_adapters/oracle_enhanced_procedures_spec.rb +68 -72
- data/spec/active_record/connection_adapters/oracle_enhanced_schema_dump_spec.rb +64 -80
- data/spec/active_record/connection_adapters/oracle_enhanced_schema_statements_spec.rb +223 -329
- data/spec/active_record/connection_adapters/oracle_enhanced_structure_dump_spec.rb +18 -20
- data/spec/spec_config.yaml.template +11 -0
- data/spec/spec_helper.rb +59 -59
- data/spec/support/alter_system_user_password.sql +2 -0
- data/spec/support/create_oracle_enhanced_users.sql +31 -0
- metadata +25 -25
- data/.rspec +0 -2
- data/Gemfile +0 -22
- data/RUNNING_TESTS.md +0 -83
- data/Rakefile +0 -45
- data/activerecord-oracle_enhanced-adapter.gemspec +0 -94
- data/lib/active_record/connection_adapters/oracle_enhanced/cpk.rb +0 -19
- data/spec/active_record/connection_adapters/oracle_enhanced_cpk_spec.rb +0 -113
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
1
|
describe "OracleEnhancedAdapter structure dump" do
|
4
2
|
include LoggerSpecHelper
|
5
3
|
|
@@ -11,7 +9,7 @@ describe "OracleEnhancedAdapter structure dump" do
|
|
11
9
|
end
|
12
10
|
describe "structure dump" do
|
13
11
|
before(:each) do
|
14
|
-
@conn.create_table :test_posts, :
|
12
|
+
@conn.create_table :test_posts, force: true do |t|
|
15
13
|
t.string :title
|
16
14
|
t.string :foo
|
17
15
|
t.integer :foo_id
|
@@ -94,7 +92,7 @@ describe "OracleEnhancedAdapter structure dump" do
|
|
94
92
|
it "should not error when no foreign keys are present" do
|
95
93
|
dump = ActiveRecord::Base.connection.structure_dump_fk_constraints
|
96
94
|
expect(dump.split('\n').length).to eq(0)
|
97
|
-
expect(dump).to eq(
|
95
|
+
expect(dump).to eq("")
|
98
96
|
end
|
99
97
|
|
100
98
|
it "should dump triggers" do
|
@@ -107,7 +105,7 @@ describe "OracleEnhancedAdapter structure dump" do
|
|
107
105
|
SELECT 'bar' INTO :new.FOO FROM DUAL;
|
108
106
|
END;
|
109
107
|
SQL
|
110
|
-
dump = ActiveRecord::Base.connection.structure_dump_db_stored_code.gsub(/\n|\s+/,
|
108
|
+
dump = ActiveRecord::Base.connection.structure_dump_db_stored_code.gsub(/\n|\s+/, " ")
|
111
109
|
expect(dump).to match(/CREATE OR REPLACE TRIGGER TEST_POST_TRIGGER/)
|
112
110
|
end
|
113
111
|
|
@@ -115,14 +113,14 @@ describe "OracleEnhancedAdapter structure dump" do
|
|
115
113
|
@conn.execute <<-SQL
|
116
114
|
create or replace TYPE TEST_TYPE AS TABLE OF VARCHAR2(10);
|
117
115
|
SQL
|
118
|
-
dump = ActiveRecord::Base.connection.structure_dump_db_stored_code.gsub(/\n|\s+/,
|
116
|
+
dump = ActiveRecord::Base.connection.structure_dump_db_stored_code.gsub(/\n|\s+/, " ")
|
119
117
|
expect(dump).to match(/CREATE OR REPLACE TYPE TEST_TYPE/)
|
120
118
|
end
|
121
119
|
|
122
120
|
it "should dump views" do
|
123
121
|
@conn.execute "create or replace VIEW test_posts_view_z as select * from test_posts"
|
124
122
|
@conn.execute "create or replace VIEW test_posts_view_a as select * from test_posts_view_z"
|
125
|
-
dump = ActiveRecord::Base.connection.structure_dump_db_stored_code.gsub(/\n|\s+/,
|
123
|
+
dump = ActiveRecord::Base.connection.structure_dump_db_stored_code.gsub(/\n|\s+/, " ")
|
126
124
|
expect(dump).to match(/CREATE OR REPLACE FORCE VIEW TEST_POSTS_VIEW_A.*CREATE OR REPLACE FORCE VIEW TEST_POSTS_VIEW_Z/)
|
127
125
|
end
|
128
126
|
|
@@ -149,7 +147,7 @@ describe "OracleEnhancedAdapter structure dump" do
|
|
149
147
|
)
|
150
148
|
SQL
|
151
149
|
dump = ActiveRecord::Base.connection.structure_dump
|
152
|
-
expect(dump).to match(/CREATE TABLE \"BARS\" \(\n\"ID\" NUMBER\(38,0\) NOT NULL,\n \"SUPER\" RAW\(255\) GENERATED ALWAYS AS \(HEXTORAW\(TO_CHAR\(ID\)\)\) VIRTUAL/)
|
150
|
+
expect(dump).to match(/CREATE TABLE \"BARS\" \(\n \"ID\" NUMBER\(38,0\) NOT NULL,\n \"SUPER\" RAW\(255\) GENERATED ALWAYS AS \(HEXTORAW\(TO_CHAR\(ID\)\)\) VIRTUAL/)
|
153
151
|
end
|
154
152
|
|
155
153
|
it "should dump unique keys" do
|
@@ -165,8 +163,8 @@ describe "OracleEnhancedAdapter structure dump" do
|
|
165
163
|
end
|
166
164
|
|
167
165
|
it "should dump indexes" do
|
168
|
-
ActiveRecord::Base.connection.add_index(:test_posts, :foo, :
|
169
|
-
ActiveRecord::Base.connection.add_index(:test_posts, :foo_id, :
|
166
|
+
ActiveRecord::Base.connection.add_index(:test_posts, :foo, name: :ix_test_posts_foo)
|
167
|
+
ActiveRecord::Base.connection.add_index(:test_posts, :foo_id, name: :ix_test_posts_foo_id, unique: true)
|
170
168
|
|
171
169
|
@conn.execute <<-SQL
|
172
170
|
ALTER TABLE test_posts
|
@@ -180,7 +178,7 @@ describe "OracleEnhancedAdapter structure dump" do
|
|
180
178
|
end
|
181
179
|
|
182
180
|
it "should dump multi-value and function value indexes" do
|
183
|
-
ActiveRecord::Base.connection.add_index(:test_posts, [:foo, :foo_id], :
|
181
|
+
ActiveRecord::Base.connection.add_index(:test_posts, [:foo, :foo_id], name: :ix_test_posts_foo_foo_id)
|
184
182
|
|
185
183
|
@conn.execute <<-SQL
|
186
184
|
CREATE INDEX "IX_TEST_POSTS_FUNCTION" ON "TEST_POSTS" (TO_CHAR(LENGTH("FOO"))||"FOO")
|
@@ -200,35 +198,35 @@ describe "OracleEnhancedAdapter structure dump" do
|
|
200
198
|
)
|
201
199
|
SQL
|
202
200
|
dump = ActiveRecord::Base.connection.structure_dump
|
203
|
-
expect(dump).to match(/CREATE TABLE \"BARS\" \(\n\"ID\" NUMBER\(38,0\) NOT NULL,\n \"SUPER\" RAW\(255\)/)
|
201
|
+
expect(dump).to match(/CREATE TABLE \"BARS\" \(\n \"ID\" NUMBER\(38,0\) NOT NULL,\n \"SUPER\" RAW\(255\)/)
|
204
202
|
end
|
205
203
|
|
206
204
|
it "should dump table comments" do
|
207
205
|
comment_sql = %Q(COMMENT ON TABLE "TEST_POSTS" IS 'Test posts with ''some'' "quotes"')
|
208
206
|
@conn.execute comment_sql
|
209
207
|
dump = ActiveRecord::Base.connection.structure_dump
|
210
|
-
dump.
|
208
|
+
expect(dump).to match(/#{comment_sql}/)
|
211
209
|
end
|
212
210
|
|
213
211
|
it "should dump column comments" do
|
214
212
|
comment_sql = %Q(COMMENT ON COLUMN "TEST_POSTS"."TITLE" IS 'The title of the post with ''some'' "quotes"')
|
215
213
|
@conn.execute comment_sql
|
216
214
|
dump = ActiveRecord::Base.connection.structure_dump
|
217
|
-
dump.
|
215
|
+
expect(dump).to match(/#{comment_sql}/)
|
218
216
|
end
|
219
217
|
|
220
218
|
it "should dump table comments" do
|
221
219
|
comment_sql = %Q(COMMENT ON TABLE "TEST_POSTS" IS 'Test posts with ''some'' "quotes"')
|
222
220
|
@conn.execute comment_sql
|
223
221
|
dump = ActiveRecord::Base.connection.structure_dump
|
224
|
-
dump.
|
222
|
+
expect(dump).to match(/#{comment_sql}/)
|
225
223
|
end
|
226
224
|
|
227
225
|
it "should dump column comments" do
|
228
226
|
comment_sql = %Q(COMMENT ON COLUMN "TEST_POSTS"."TITLE" IS 'The title of the post with ''some'' "quotes"')
|
229
227
|
@conn.execute comment_sql
|
230
228
|
dump = ActiveRecord::Base.connection.structure_dump
|
231
|
-
dump.
|
229
|
+
expect(dump).to match(/#{comment_sql}/)
|
232
230
|
end
|
233
231
|
|
234
232
|
end
|
@@ -237,7 +235,7 @@ describe "OracleEnhancedAdapter structure dump" do
|
|
237
235
|
@conn.drop_table :test_comments rescue nil
|
238
236
|
end
|
239
237
|
it "should dump correctly" do
|
240
|
-
@conn.create_table :test_comments, :
|
238
|
+
@conn.create_table :test_comments, temporary: true, id: false do |t|
|
241
239
|
t.integer :post_id
|
242
240
|
end
|
243
241
|
dump = ActiveRecord::Base.connection.structure_dump
|
@@ -267,7 +265,7 @@ describe "OracleEnhancedAdapter structure dump" do
|
|
267
265
|
|
268
266
|
describe "temp_table_drop" do
|
269
267
|
before(:each) do
|
270
|
-
@conn.create_table :temp_tbl, :
|
268
|
+
@conn.create_table :temp_tbl, temporary: true do |t|
|
271
269
|
t.string :foo
|
272
270
|
end
|
273
271
|
@conn.create_table :not_temp_tbl do |t|
|
@@ -298,7 +296,7 @@ describe "OracleEnhancedAdapter structure dump" do
|
|
298
296
|
ActiveRecord::SchemaMigration.reset_table_name
|
299
297
|
ActiveRecord::SchemaMigration.create_table
|
300
298
|
versions.each do |i|
|
301
|
-
ActiveRecord::SchemaMigration.create!(:
|
299
|
+
ActiveRecord::SchemaMigration.create!(version: i)
|
302
300
|
end
|
303
301
|
end
|
304
302
|
|
@@ -347,7 +345,7 @@ describe "OracleEnhancedAdapter structure dump" do
|
|
347
345
|
@conn.create_table :full_drop_test do |t|
|
348
346
|
t.string :foo
|
349
347
|
end
|
350
|
-
@conn.create_table :full_drop_test_temp, :
|
348
|
+
@conn.create_table :full_drop_test_temp, temporary: true do |t|
|
351
349
|
t.string :foo
|
352
350
|
end
|
353
351
|
#view
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# copy this file to spec/config.yaml and set appropriate values
|
2
|
+
# you can also use environment variables, see spec_helper.rb
|
3
|
+
database:
|
4
|
+
name: 'orcl'
|
5
|
+
host: '127.0.0.1'
|
6
|
+
port: 1521
|
7
|
+
user: 'oracle_enhanced'
|
8
|
+
password: 'oracle_enhanced'
|
9
|
+
sys_password: 'admin'
|
10
|
+
non_default_tablespace: 'SYSTEM'
|
11
|
+
timezone: 'Europe/Riga'
|
data/spec/spec_helper.rb
CHANGED
@@ -1,41 +1,41 @@
|
|
1
|
+
require "simplecov"
|
2
|
+
SimpleCov.start
|
1
3
|
require "rubygems"
|
2
4
|
require "bundler"
|
3
5
|
require "yaml"
|
4
6
|
Bundler.setup(:default, :development)
|
5
7
|
|
6
|
-
$:.unshift(File.expand_path(
|
7
|
-
config_path = File.expand_path(
|
8
|
+
$:.unshift(File.expand_path("../../lib", __FILE__))
|
9
|
+
config_path = File.expand_path("../spec_config.yaml", __FILE__)
|
8
10
|
if File.exist?(config_path)
|
9
11
|
puts "==> Loading config from #{config_path}"
|
10
12
|
config = YAML.load_file(config_path)
|
11
13
|
else
|
12
14
|
puts "==> Loading config from ENV or use default"
|
13
|
-
config = {"rails" => {}, "database" => {}}
|
15
|
+
config = { "rails" => {}, "database" => {} }
|
14
16
|
end
|
15
17
|
|
16
|
-
require
|
18
|
+
require "rspec"
|
17
19
|
|
18
|
-
if !defined?(RUBY_ENGINE) || RUBY_ENGINE ==
|
20
|
+
if !defined?(RUBY_ENGINE) || RUBY_ENGINE == "ruby"
|
19
21
|
puts "==> Running specs with MRI version #{RUBY_VERSION}"
|
20
|
-
require
|
21
|
-
elsif RUBY_ENGINE ==
|
22
|
+
require "oci8"
|
23
|
+
elsif RUBY_ENGINE == "jruby"
|
22
24
|
puts "==> Running specs with JRuby version #{JRUBY_VERSION}"
|
23
25
|
end
|
24
26
|
|
25
|
-
|
27
|
+
require "active_record"
|
26
28
|
|
27
|
-
require
|
28
|
-
|
29
|
-
require 'active_support/core_ext/module/attribute_accessors'
|
30
|
-
require 'active_support/core_ext/class/attribute_accessors'
|
29
|
+
require "active_support/core_ext/module/attribute_accessors"
|
30
|
+
require "active_support/core_ext/class/attribute_accessors"
|
31
31
|
|
32
32
|
require "active_support/log_subscriber"
|
33
|
-
require
|
33
|
+
require "active_record/log_subscriber"
|
34
34
|
|
35
|
-
require
|
35
|
+
require "logger"
|
36
36
|
|
37
|
-
require
|
38
|
-
require
|
37
|
+
require "active_record/connection_adapters/oracle_enhanced_adapter"
|
38
|
+
require "ruby-plsql"
|
39
39
|
|
40
40
|
puts "==> Effective ActiveRecord version #{ActiveRecord::VERSION::STRING}"
|
41
41
|
|
@@ -61,7 +61,7 @@ module LoggerSpecHelper
|
|
61
61
|
|
62
62
|
def initialize
|
63
63
|
@flush_count = 0
|
64
|
-
@logged = Hash.new { |h,k| h[k] = [] }
|
64
|
+
@logged = Hash.new { |h, k| h[k] = [] }
|
65
65
|
end
|
66
66
|
|
67
67
|
# used in AtiveRecord 2.x
|
@@ -115,66 +115,66 @@ module SchemaSpecHelper
|
|
115
115
|
end
|
116
116
|
end
|
117
117
|
|
118
|
-
DATABASE_NAME = config["database"]["name"] || ENV[
|
119
|
-
DATABASE_HOST = config["database"]["host"] || ENV[
|
120
|
-
DATABASE_PORT = config["database"]["port"] || ENV[
|
121
|
-
DATABASE_USER = config["database"]["user"] || ENV[
|
122
|
-
DATABASE_PASSWORD = config["database"]["password"] || ENV[
|
123
|
-
DATABASE_SCHEMA = config["database"]["schema"] || ENV[
|
124
|
-
DATABASE_SYS_PASSWORD = config["database"]["sys_password"] || ENV[
|
118
|
+
DATABASE_NAME = config["database"]["name"] || ENV["DATABASE_NAME"] || "orcl"
|
119
|
+
DATABASE_HOST = config["database"]["host"] || ENV["DATABASE_HOST"] || "127.0.0.1"
|
120
|
+
DATABASE_PORT = config["database"]["port"] || ENV["DATABASE_PORT"] || 1521
|
121
|
+
DATABASE_USER = config["database"]["user"] || ENV["DATABASE_USER"] || "oracle_enhanced"
|
122
|
+
DATABASE_PASSWORD = config["database"]["password"] || ENV["DATABASE_PASSWORD"] || "oracle_enhanced"
|
123
|
+
DATABASE_SCHEMA = config["database"]["schema"] || ENV["DATABASE_SCHEMA"] || "oracle_enhanced_schema"
|
124
|
+
DATABASE_SYS_PASSWORD = config["database"]["sys_password"] || ENV["DATABASE_SYS_PASSWORD"] || "admin"
|
125
125
|
|
126
126
|
CONNECTION_PARAMS = {
|
127
|
-
:
|
128
|
-
:
|
129
|
-
:
|
130
|
-
:
|
131
|
-
:
|
132
|
-
:
|
127
|
+
adapter: "oracle_enhanced",
|
128
|
+
database: DATABASE_NAME,
|
129
|
+
host: DATABASE_HOST,
|
130
|
+
port: DATABASE_PORT,
|
131
|
+
username: DATABASE_USER,
|
132
|
+
password: DATABASE_PASSWORD
|
133
133
|
}
|
134
134
|
|
135
135
|
CONNECTION_WITH_SCHEMA_PARAMS = {
|
136
|
-
:
|
137
|
-
:
|
138
|
-
:
|
139
|
-
:
|
140
|
-
:
|
141
|
-
:
|
142
|
-
:
|
136
|
+
adapter: "oracle_enhanced",
|
137
|
+
database: DATABASE_NAME,
|
138
|
+
host: DATABASE_HOST,
|
139
|
+
port: DATABASE_PORT,
|
140
|
+
username: DATABASE_USER,
|
141
|
+
password: DATABASE_PASSWORD,
|
142
|
+
schema: DATABASE_SCHEMA
|
143
143
|
}
|
144
144
|
|
145
145
|
CONNECTION_WITH_TIMEZONE_PARAMS = {
|
146
|
-
:
|
147
|
-
:
|
148
|
-
:
|
149
|
-
:
|
150
|
-
:
|
151
|
-
:
|
152
|
-
:
|
146
|
+
adapter: "oracle_enhanced",
|
147
|
+
database: DATABASE_NAME,
|
148
|
+
host: DATABASE_HOST,
|
149
|
+
port: DATABASE_PORT,
|
150
|
+
username: DATABASE_USER,
|
151
|
+
password: DATABASE_PASSWORD,
|
152
|
+
time_zone: "Europe/Riga"
|
153
153
|
}
|
154
154
|
|
155
155
|
SYS_CONNECTION_PARAMS = {
|
156
|
-
:
|
157
|
-
:
|
158
|
-
:
|
159
|
-
:
|
160
|
-
:
|
161
|
-
:
|
162
|
-
:
|
156
|
+
adapter: "oracle_enhanced",
|
157
|
+
database: DATABASE_NAME,
|
158
|
+
host: DATABASE_HOST,
|
159
|
+
port: DATABASE_PORT,
|
160
|
+
username: "sys",
|
161
|
+
password: DATABASE_SYS_PASSWORD,
|
162
|
+
privilege: "SYSDBA"
|
163
163
|
}
|
164
164
|
|
165
165
|
SYSTEM_CONNECTION_PARAMS = {
|
166
|
-
:
|
167
|
-
:
|
168
|
-
:
|
169
|
-
:
|
170
|
-
:
|
171
|
-
:
|
166
|
+
adapter: "oracle_enhanced",
|
167
|
+
database: DATABASE_NAME,
|
168
|
+
host: DATABASE_HOST,
|
169
|
+
port: DATABASE_PORT,
|
170
|
+
username: "system",
|
171
|
+
password: DATABASE_SYS_PASSWORD
|
172
172
|
}
|
173
173
|
|
174
|
-
DATABASE_NON_DEFAULT_TABLESPACE = config["database"]["non_default_tablespace"] || ENV[
|
174
|
+
DATABASE_NON_DEFAULT_TABLESPACE = config["database"]["non_default_tablespace"] || ENV["DATABASE_NON_DEFAULT_TABLESPACE"] || "SYSTEM"
|
175
175
|
|
176
176
|
# set default time zone in TZ environment variable
|
177
177
|
# which will be used to set session time zone
|
178
|
-
ENV[
|
178
|
+
ENV["TZ"] ||= config["timezone"] || "Europe/Riga"
|
179
179
|
|
180
180
|
# ActiveRecord::Base.logger = Logger.new(STDOUT)
|
@@ -0,0 +1,31 @@
|
|
1
|
+
alter database default tablespace USERS;
|
2
|
+
|
3
|
+
CREATE USER oracle_enhanced IDENTIFIED BY oracle_enhanced;
|
4
|
+
|
5
|
+
GRANT unlimited tablespace, create session, create table, create sequence,
|
6
|
+
create procedure, create trigger, create view, create materialized view,
|
7
|
+
create database link, create synonym, create type, ctxapp TO oracle_enhanced;
|
8
|
+
|
9
|
+
CREATE USER oracle_enhanced_schema IDENTIFIED BY oracle_enhanced_schema;
|
10
|
+
|
11
|
+
GRANT unlimited tablespace, create session, create table, create sequence,
|
12
|
+
create procedure, create trigger, create view, create materialized view,
|
13
|
+
create database link, create synonym, create type, ctxapp TO oracle_enhanced_schema;
|
14
|
+
|
15
|
+
CREATE USER arunit IDENTIFIED BY arunit;
|
16
|
+
|
17
|
+
GRANT unlimited tablespace, create session, create table, create sequence,
|
18
|
+
create procedure, create trigger, create view, create materialized view,
|
19
|
+
create database link, create synonym, create type, ctxapp TO arunit;
|
20
|
+
|
21
|
+
CREATE USER arunit2 IDENTIFIED BY arunit2;
|
22
|
+
|
23
|
+
GRANT unlimited tablespace, create session, create table, create sequence,
|
24
|
+
create procedure, create trigger, create view, create materialized view,
|
25
|
+
create database link, create synonym, create type, ctxapp TO arunit2;
|
26
|
+
|
27
|
+
CREATE USER ruby IDENTIFIED BY oci8;
|
28
|
+
GRANT connect, resource, create view,create synonym TO ruby;
|
29
|
+
GRANT EXECUTE ON dbms_lock TO ruby;
|
30
|
+
GRANT CREATE VIEW TO ruby;
|
31
|
+
GRANT unlimited tablespace to ruby;
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-oracle_enhanced-adapter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Raimonds Simanovskis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -16,42 +16,42 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 5.
|
19
|
+
version: 5.1.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 5.
|
26
|
+
version: 5.1.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: arel
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: '8.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: '8.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: ruby-plsql
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.
|
47
|
+
version: 0.6.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.
|
54
|
+
version: 0.6.0
|
55
55
|
description: |
|
56
56
|
Oracle "enhanced" ActiveRecord adapter contains useful additional methods for working with new and legacy Oracle databases.
|
57
57
|
This adapter is superset of original ActiveRecord Oracle adapter.
|
@@ -61,21 +61,15 @@ extensions: []
|
|
61
61
|
extra_rdoc_files:
|
62
62
|
- README.md
|
63
63
|
files:
|
64
|
-
- ".rspec"
|
65
|
-
- Gemfile
|
66
64
|
- History.md
|
67
65
|
- License.txt
|
68
66
|
- README.md
|
69
|
-
- RUNNING_TESTS.md
|
70
|
-
- Rakefile
|
71
67
|
- VERSION
|
72
|
-
- activerecord-oracle_enhanced-adapter.gemspec
|
73
68
|
- lib/active_record/connection_adapters/emulation/oracle_adapter.rb
|
74
69
|
- lib/active_record/connection_adapters/oracle_enhanced/column.rb
|
75
70
|
- lib/active_record/connection_adapters/oracle_enhanced/column_dumper.rb
|
76
71
|
- lib/active_record/connection_adapters/oracle_enhanced/connection.rb
|
77
72
|
- lib/active_record/connection_adapters/oracle_enhanced/context_index.rb
|
78
|
-
- lib/active_record/connection_adapters/oracle_enhanced/cpk.rb
|
79
73
|
- lib/active_record/connection_adapters/oracle_enhanced/database_statements.rb
|
80
74
|
- lib/active_record/connection_adapters/oracle_enhanced/database_tasks.rb
|
81
75
|
- lib/active_record/connection_adapters/oracle_enhanced/jdbc_connection.rb
|
@@ -94,15 +88,16 @@ files:
|
|
94
88
|
- lib/active_record/connection_adapters/oracle_enhanced_adapter.rb
|
95
89
|
- lib/active_record/oracle_enhanced/type/boolean.rb
|
96
90
|
- lib/active_record/oracle_enhanced/type/integer.rb
|
91
|
+
- lib/active_record/oracle_enhanced/type/json.rb
|
97
92
|
- lib/active_record/oracle_enhanced/type/national_character_string.rb
|
98
93
|
- lib/active_record/oracle_enhanced/type/raw.rb
|
99
94
|
- lib/active_record/oracle_enhanced/type/string.rb
|
100
95
|
- lib/active_record/oracle_enhanced/type/text.rb
|
96
|
+
- lib/active_record/oracle_enhanced/type/timestamptz.rb
|
101
97
|
- lib/activerecord-oracle_enhanced-adapter.rb
|
102
98
|
- spec/active_record/connection_adapters/oracle_enhanced_adapter_spec.rb
|
103
99
|
- spec/active_record/connection_adapters/oracle_enhanced_connection_spec.rb
|
104
100
|
- spec/active_record/connection_adapters/oracle_enhanced_context_index_spec.rb
|
105
|
-
- spec/active_record/connection_adapters/oracle_enhanced_cpk_spec.rb
|
106
101
|
- spec/active_record/connection_adapters/oracle_enhanced_data_types_spec.rb
|
107
102
|
- spec/active_record/connection_adapters/oracle_enhanced_database_tasks_spec.rb
|
108
103
|
- spec/active_record/connection_adapters/oracle_enhanced_dbms_output_spec.rb
|
@@ -112,7 +107,10 @@ files:
|
|
112
107
|
- spec/active_record/connection_adapters/oracle_enhanced_schema_dump_spec.rb
|
113
108
|
- spec/active_record/connection_adapters/oracle_enhanced_schema_statements_spec.rb
|
114
109
|
- spec/active_record/connection_adapters/oracle_enhanced_structure_dump_spec.rb
|
110
|
+
- spec/spec_config.yaml.template
|
115
111
|
- spec/spec_helper.rb
|
112
|
+
- spec/support/alter_system_user_password.sql
|
113
|
+
- spec/support/create_oracle_enhanced_users.sql
|
116
114
|
homepage: http://github.com/rsim/oracle-enhanced
|
117
115
|
licenses:
|
118
116
|
- MIT
|
@@ -130,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
130
128
|
requirements:
|
131
129
|
- - ">="
|
132
130
|
- !ruby/object:Gem::Version
|
133
|
-
version:
|
131
|
+
version: 1.8.11
|
134
132
|
requirements: []
|
135
133
|
rubyforge_project:
|
136
134
|
rubygems_version: 2.6.11
|
@@ -138,17 +136,19 @@ signing_key:
|
|
138
136
|
specification_version: 4
|
139
137
|
summary: Oracle enhanced adapter for ActiveRecord
|
140
138
|
test_files:
|
141
|
-
- spec/
|
142
|
-
- spec/
|
143
|
-
- spec/
|
144
|
-
- spec/
|
139
|
+
- spec/support/create_oracle_enhanced_users.sql
|
140
|
+
- spec/support/alter_system_user_password.sql
|
141
|
+
- spec/spec_config.yaml.template
|
142
|
+
- spec/spec_helper.rb
|
145
143
|
- spec/active_record/connection_adapters/oracle_enhanced_database_tasks_spec.rb
|
144
|
+
- spec/active_record/connection_adapters/oracle_enhanced_adapter_spec.rb
|
146
145
|
- spec/active_record/connection_adapters/oracle_enhanced_data_types_spec.rb
|
147
|
-
- spec/active_record/connection_adapters/
|
146
|
+
- spec/active_record/connection_adapters/oracle_enhanced_structure_dump_spec.rb
|
147
|
+
- spec/active_record/connection_adapters/oracle_enhanced_schema_dump_spec.rb
|
148
|
+
- spec/active_record/connection_adapters/oracle_enhanced_context_index_spec.rb
|
149
|
+
- spec/active_record/connection_adapters/oracle_enhanced_connection_spec.rb
|
150
|
+
- spec/active_record/connection_adapters/oracle_enhanced_procedures_spec.rb
|
148
151
|
- spec/active_record/connection_adapters/oracle_enhanced_dirty_spec.rb
|
149
152
|
- spec/active_record/connection_adapters/oracle_enhanced_emulate_oracle_adapter_spec.rb
|
150
|
-
- spec/active_record/connection_adapters/oracle_enhanced_procedures_spec.rb
|
151
|
-
- spec/active_record/connection_adapters/oracle_enhanced_schema_dump_spec.rb
|
152
153
|
- spec/active_record/connection_adapters/oracle_enhanced_schema_statements_spec.rb
|
153
|
-
- spec/active_record/connection_adapters/
|
154
|
-
- spec/spec_helper.rb
|
154
|
+
- spec/active_record/connection_adapters/oracle_enhanced_dbms_output_spec.rb
|
data/.rspec
DELETED
data/Gemfile
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
source 'http://rubygems.org'
|
2
|
-
|
3
|
-
group :development do
|
4
|
-
gem 'rspec', '~> 3.3'
|
5
|
-
gem 'rdoc'
|
6
|
-
gem 'rake'
|
7
|
-
|
8
|
-
gem 'activerecord', github: 'rails/rails', branch: '5-0-stable'
|
9
|
-
gem 'rack', github: 'rack/rack', branch: 'master'
|
10
|
-
gem 'arel', github: 'rails/arel', branch: '7-1-stable'
|
11
|
-
|
12
|
-
gem 'ruby-plsql', '>=0.5.0'
|
13
|
-
|
14
|
-
platforms :ruby do
|
15
|
-
gem 'ruby-oci8', github: 'kubo/ruby-oci8'
|
16
|
-
gem 'byebug'
|
17
|
-
end
|
18
|
-
|
19
|
-
platforms :jruby do
|
20
|
-
gem 'ruby-debug'
|
21
|
-
end
|
22
|
-
end
|
data/RUNNING_TESTS.md
DELETED
@@ -1,83 +0,0 @@
|
|
1
|
-
Creating the test database
|
2
|
-
--------------------------
|
3
|
-
|
4
|
-
You need Oracle database (version 10.2 or later) with SYS and SYSTEM user access.
|
5
|
-
|
6
|
-
If you are on a Mac OS X 10.6 then use [these instructions](http://blog.rayapps.com/2009/09/14/how-to-install-oracle-database-10g-on-mac-os-x-snow-leopard) to install local Oracle DB 10.2.0.4. Other option is to use Linux VM and install Oracle DB on it.
|
7
|
-
|
8
|
-
If you are on Linux (or will use Linux virtual machine) and need Oracle DB just for running tests then Oracle DB XE edition is enough. See [Oracle XE downloads page](http://www.oracle.com/technetwork/database/express-edition/downloads/index.html) for download links and instructions.
|
9
|
-
|
10
|
-
If you are getting ORA-12520 errors when running tests then it means that Oracle cannot create enough processes to handle many connections (as during tests many connections are created and destroyed). In this case you need to log in as SYSTEM user and execute e.g.
|
11
|
-
|
12
|
-
alter system set processes=200 scope=spfile;
|
13
|
-
|
14
|
-
to increase process limit and then restart the database (this will be necessary if Oracle XE will be used as default processes limit is 40).
|
15
|
-
|
16
|
-
### Docker
|
17
|
-
If no Oracle database with SYS and SYSTEM user access is available, try the docker approach.
|
18
|
-
|
19
|
-
Install [Docker](https://docker.github.io/engine/installation/)
|
20
|
-
|
21
|
-
Pull [docker-oracle-xe-11g](https://hub.docker.com/r/wnameless/oracle-xe-11g/) image from docker hub
|
22
|
-
|
23
|
-
docker pull wnameless/oracle-xe-11g
|
24
|
-
|
25
|
-
Start a Oracle database docker container with mapped ports. Use port `49161` to access the database.
|
26
|
-
|
27
|
-
docker run -d -p 49160:22 -p 49161:1521 wnameless/oracle-xe-11g
|
28
|
-
|
29
|
-
Check connection to the database with `sqlplus`. The user is `system`, the password is `oracle`.
|
30
|
-
|
31
|
-
sqlplus64 system/oracle@localhost:49161
|
32
|
-
|
33
|
-
The oracle enhanced configuration file `spec/spec_config.yaml` should look like:
|
34
|
-
|
35
|
-
```yaml
|
36
|
-
# copy this file to spec/config.yaml and set appropriate values
|
37
|
-
# you can also use environment variables, see spec_helper.rb
|
38
|
-
database:
|
39
|
-
name: 'xe'
|
40
|
-
host: 'localhost'
|
41
|
-
port: 49161
|
42
|
-
user: 'oracle_enhanced'
|
43
|
-
password: 'oracle_enhanced'
|
44
|
-
sys_password: 'oracle'
|
45
|
-
non_default_tablespace: 'SYSTEM'
|
46
|
-
timezone: 'Europe/Riga'
|
47
|
-
```
|
48
|
-
|
49
|
-
Ruby versions
|
50
|
-
-------------
|
51
|
-
|
52
|
-
oracle_enhanced is tested with MRI 2.1.x and 2.2.x, and JRuby 1.7.x and 9.0.x.x.
|
53
|
-
|
54
|
-
It is recommended to use [RVM](http://rvm.beginrescueend.com) to run tests with different Ruby implementations.
|
55
|
-
|
56
|
-
Running tests
|
57
|
-
-------------
|
58
|
-
|
59
|
-
* Create Oracle database schema for test purposes. Review `spec/spec_helper.rb` to see default schema/user names and database names (use environment variables to override defaults)
|
60
|
-
|
61
|
-
SQL> CREATE USER oracle_enhanced IDENTIFIED BY oracle_enhanced;
|
62
|
-
SQL> GRANT unlimited tablespace, create session, create table, create sequence, create procedure, create trigger, create view, create materialized view, create database link, create synonym, create type, ctxapp TO oracle_enhanced;
|
63
|
-
|
64
|
-
SQL> CREATE USER oracle_enhanced_schema IDENTIFIED BY oracle_enhanced_schema;
|
65
|
-
SQL> GRANT unlimited tablespace, create session, create table, create sequence, create procedure, create trigger, create view, create materialized view, create database link, create synonym, create type, ctxapp TO oracle_enhanced_schema;
|
66
|
-
|
67
|
-
* If you use RVM then switch to corresponding Ruby. It is recommended to create isolated gemsets for test purposes (e.g. rvm create gemset oracle_enhanced)
|
68
|
-
|
69
|
-
* Install bundler with
|
70
|
-
|
71
|
-
gem install bundler
|
72
|
-
|
73
|
-
* Install necessary gems with
|
74
|
-
|
75
|
-
bundle install
|
76
|
-
|
77
|
-
* Configure database credentials in one of two ways:
|
78
|
-
* copy spec/spec_config.yaml.template to spec/spec_config.yaml and modify as needed
|
79
|
-
* set required environment variables (see DATABASE_NAME in spec_helper.rb)
|
80
|
-
|
81
|
-
* Run tests with
|
82
|
-
|
83
|
-
rake spec
|