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
data/Rakefile
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'bundler'
|
3
|
-
require 'bundler/gem_tasks'
|
4
|
-
begin
|
5
|
-
Bundler.setup(:default, :development)
|
6
|
-
rescue Bundler::BundlerError => e
|
7
|
-
$stderr.puts e.message
|
8
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
9
|
-
exit e.status_code
|
10
|
-
end
|
11
|
-
|
12
|
-
require 'rake'
|
13
|
-
|
14
|
-
require 'rspec/core/rake_task'
|
15
|
-
RSpec::Core::RakeTask.new(:spec)
|
16
|
-
|
17
|
-
RSpec::Core::RakeTask.new(:rcov) do |t|
|
18
|
-
t.rcov = true
|
19
|
-
t.rcov_opts = ['--exclude', '/Library,spec/']
|
20
|
-
end
|
21
|
-
|
22
|
-
desc "Clear test database"
|
23
|
-
task :clear do
|
24
|
-
require "./spec/spec_helper"
|
25
|
-
ActiveRecord::Base.establish_connection(CONNECTION_PARAMS)
|
26
|
-
require "active_support/core_ext"
|
27
|
-
ActiveRecord::Base.connection.execute_structure_dump(ActiveRecord::Base.connection.full_drop)
|
28
|
-
ActiveRecord::Base.connection.execute("PURGE RECYCLEBIN") rescue nil
|
29
|
-
end
|
30
|
-
|
31
|
-
# Clear test database before running spec and rcov
|
32
|
-
task :spec => :clear
|
33
|
-
task :rcov => :clear
|
34
|
-
|
35
|
-
task :default => :spec
|
36
|
-
|
37
|
-
require 'rdoc/task'
|
38
|
-
Rake::RDocTask.new do |rdoc|
|
39
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
40
|
-
|
41
|
-
rdoc.rdoc_dir = 'doc'
|
42
|
-
rdoc.title = "activerecord-oracle_enhanced-adapter #{version}"
|
43
|
-
rdoc.rdoc_files.include('README*')
|
44
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
45
|
-
end
|
@@ -1,94 +0,0 @@
|
|
1
|
-
Gem::Specification.new do |s|
|
2
|
-
s.name = %q{activerecord-oracle_enhanced-adapter}
|
3
|
-
s.version = "1.7.11"
|
4
|
-
|
5
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
6
|
-
s.required_ruby_version = '>= 2.2.2'
|
7
|
-
s.license = 'MIT'
|
8
|
-
s.authors = [%q{Raimonds Simanovskis}]
|
9
|
-
s.date = %q{2017-03-29}
|
10
|
-
s.description = %q{Oracle "enhanced" ActiveRecord adapter contains useful additional methods for working with new and legacy Oracle databases.
|
11
|
-
This adapter is superset of original ActiveRecord Oracle adapter.
|
12
|
-
}
|
13
|
-
s.email = %q{raimonds.simanovskis@gmail.com}
|
14
|
-
s.extra_rdoc_files = [
|
15
|
-
"README.md"
|
16
|
-
]
|
17
|
-
s.files = [
|
18
|
-
".rspec",
|
19
|
-
"Gemfile",
|
20
|
-
"History.md",
|
21
|
-
"License.txt",
|
22
|
-
"README.md",
|
23
|
-
"RUNNING_TESTS.md",
|
24
|
-
"Rakefile",
|
25
|
-
"VERSION",
|
26
|
-
"activerecord-oracle_enhanced-adapter.gemspec",
|
27
|
-
"lib/active_record/connection_adapters/emulation/oracle_adapter.rb",
|
28
|
-
"lib/active_record/connection_adapters/oracle_enhanced_adapter.rb",
|
29
|
-
"lib/active_record/connection_adapters/oracle_enhanced/column.rb",
|
30
|
-
"lib/active_record/connection_adapters/oracle_enhanced/column_dumper.rb",
|
31
|
-
"lib/active_record/connection_adapters/oracle_enhanced/connection.rb",
|
32
|
-
"lib/active_record/connection_adapters/oracle_enhanced/context_index.rb",
|
33
|
-
"lib/active_record/connection_adapters/oracle_enhanced/cpk.rb",
|
34
|
-
"lib/active_record/connection_adapters/oracle_enhanced/database_statements.rb",
|
35
|
-
"lib/active_record/connection_adapters/oracle_enhanced/database_tasks.rb",
|
36
|
-
"lib/active_record/connection_adapters/oracle_enhanced/jdbc_connection.rb",
|
37
|
-
"lib/active_record/connection_adapters/oracle_enhanced/jdbc_quoting.rb",
|
38
|
-
"lib/active_record/connection_adapters/oracle_enhanced/oci_connection.rb",
|
39
|
-
"lib/active_record/connection_adapters/oracle_enhanced/oci_quoting.rb",
|
40
|
-
"lib/active_record/connection_adapters/oracle_enhanced/procedures.rb",
|
41
|
-
"lib/active_record/connection_adapters/oracle_enhanced/quoting.rb",
|
42
|
-
"lib/active_record/connection_adapters/oracle_enhanced/schema_creation.rb",
|
43
|
-
"lib/active_record/connection_adapters/oracle_enhanced/schema_definitions.rb",
|
44
|
-
"lib/active_record/connection_adapters/oracle_enhanced/schema_dumper.rb",
|
45
|
-
"lib/active_record/connection_adapters/oracle_enhanced/schema_statements.rb",
|
46
|
-
"lib/active_record/connection_adapters/oracle_enhanced/schema_statements_ext.rb",
|
47
|
-
"lib/active_record/connection_adapters/oracle_enhanced/structure_dump.rb",
|
48
|
-
"lib/active_record/connection_adapters/oracle_enhanced/version.rb",
|
49
|
-
"lib/active_record/oracle_enhanced/type/boolean.rb",
|
50
|
-
"lib/active_record/oracle_enhanced/type/integer.rb",
|
51
|
-
"lib/active_record/oracle_enhanced/type/national_character_string.rb",
|
52
|
-
"lib/active_record/oracle_enhanced/type/raw.rb",
|
53
|
-
"lib/active_record/oracle_enhanced/type/string.rb",
|
54
|
-
"lib/active_record/oracle_enhanced/type/text.rb",
|
55
|
-
"lib/activerecord-oracle_enhanced-adapter.rb",
|
56
|
-
"spec/active_record/connection_adapters/oracle_enhanced_adapter_spec.rb",
|
57
|
-
"spec/active_record/connection_adapters/oracle_enhanced_connection_spec.rb",
|
58
|
-
"spec/active_record/connection_adapters/oracle_enhanced_context_index_spec.rb",
|
59
|
-
"spec/active_record/connection_adapters/oracle_enhanced_cpk_spec.rb",
|
60
|
-
"spec/active_record/connection_adapters/oracle_enhanced_database_tasks_spec.rb",
|
61
|
-
"spec/active_record/connection_adapters/oracle_enhanced_data_types_spec.rb",
|
62
|
-
"spec/active_record/connection_adapters/oracle_enhanced_dbms_output_spec.rb",
|
63
|
-
"spec/active_record/connection_adapters/oracle_enhanced_dirty_spec.rb",
|
64
|
-
"spec/active_record/connection_adapters/oracle_enhanced_emulate_oracle_adapter_spec.rb",
|
65
|
-
"spec/active_record/connection_adapters/oracle_enhanced_procedures_spec.rb",
|
66
|
-
"spec/active_record/connection_adapters/oracle_enhanced_schema_dump_spec.rb",
|
67
|
-
"spec/active_record/connection_adapters/oracle_enhanced_schema_statements_spec.rb",
|
68
|
-
"spec/active_record/connection_adapters/oracle_enhanced_structure_dump_spec.rb",
|
69
|
-
"spec/spec_helper.rb"
|
70
|
-
]
|
71
|
-
s.homepage = %q{http://github.com/rsim/oracle-enhanced}
|
72
|
-
s.require_paths = [%q{lib}]
|
73
|
-
s.summary = %q{Oracle enhanced adapter for ActiveRecord}
|
74
|
-
s.test_files = [
|
75
|
-
"spec/active_record/connection_adapters/oracle_enhanced_adapter_spec.rb",
|
76
|
-
"spec/active_record/connection_adapters/oracle_enhanced_connection_spec.rb",
|
77
|
-
"spec/active_record/connection_adapters/oracle_enhanced_context_index_spec.rb",
|
78
|
-
"spec/active_record/connection_adapters/oracle_enhanced_cpk_spec.rb",
|
79
|
-
"spec/active_record/connection_adapters/oracle_enhanced_database_tasks_spec.rb",
|
80
|
-
"spec/active_record/connection_adapters/oracle_enhanced_data_types_spec.rb",
|
81
|
-
"spec/active_record/connection_adapters/oracle_enhanced_dbms_output_spec.rb",
|
82
|
-
"spec/active_record/connection_adapters/oracle_enhanced_dirty_spec.rb",
|
83
|
-
"spec/active_record/connection_adapters/oracle_enhanced_emulate_oracle_adapter_spec.rb",
|
84
|
-
"spec/active_record/connection_adapters/oracle_enhanced_procedures_spec.rb",
|
85
|
-
"spec/active_record/connection_adapters/oracle_enhanced_schema_dump_spec.rb",
|
86
|
-
"spec/active_record/connection_adapters/oracle_enhanced_schema_statements_spec.rb",
|
87
|
-
"spec/active_record/connection_adapters/oracle_enhanced_structure_dump_spec.rb",
|
88
|
-
"spec/spec_helper.rb"
|
89
|
-
]
|
90
|
-
s.add_runtime_dependency(%q<activerecord>, ["~> 5.0.0"])
|
91
|
-
s.add_runtime_dependency(%q<arel>, ["~> 7.1.4"])
|
92
|
-
s.add_runtime_dependency(%q<ruby-plsql>, [">= 0.5.0"])
|
93
|
-
s.license = 'MIT'
|
94
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
module ActiveRecord #:nodoc:
|
2
|
-
module ConnectionAdapters #:nodoc:
|
3
|
-
module OracleEnhancedCpk #:nodoc:
|
4
|
-
# This mightn't be in Core, but count(distinct x,y) doesn't work for me.
|
5
|
-
# Return that not supported if composite_primary_keys gem is required.
|
6
|
-
def supports_count_distinct? #:nodoc:
|
7
|
-
@supports_count_distinct ||= ! defined?(CompositePrimaryKeys)
|
8
|
-
end
|
9
|
-
|
10
|
-
def concat(*columns) #:nodoc:
|
11
|
-
"(#{columns.join('||')})"
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.class_eval do
|
18
|
-
include ActiveRecord::ConnectionAdapters::OracleEnhancedCpk
|
19
|
-
end
|
@@ -1,113 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
unless defined?(NO_COMPOSITE_PRIMARY_KEYS)
|
4
|
-
|
5
|
-
describe "OracleEnhancedAdapter composite_primary_keys support" do
|
6
|
-
include SchemaSpecHelper
|
7
|
-
|
8
|
-
before(:all) do
|
9
|
-
if defined?(::ActiveRecord::ConnectionAdapters::OracleAdapter)
|
10
|
-
@old_oracle_adapter = ::ActiveRecord::ConnectionAdapters::OracleAdapter
|
11
|
-
::ActiveRecord::ConnectionAdapters.send(:remove_const, :OracleAdapter)
|
12
|
-
end
|
13
|
-
ActiveRecord::Base.establish_connection(CONNECTION_PARAMS)
|
14
|
-
if $cpk_oracle_adapter
|
15
|
-
::ActiveRecord::ConnectionAdapters::OracleAdapter = $cpk_oracle_adapter
|
16
|
-
$cpk_oracle_adapter = nil
|
17
|
-
end
|
18
|
-
require 'composite_primary_keys'
|
19
|
-
end
|
20
|
-
|
21
|
-
after(:all) do
|
22
|
-
# Object.send(:remove_const, 'CompositePrimaryKeys') if defined?(CompositePrimaryKeys)
|
23
|
-
if defined?(::ActiveRecord::ConnectionAdapters::OracleAdapter)
|
24
|
-
$cpk_oracle_adapter = ::ActiveRecord::ConnectionAdapters::OracleAdapter
|
25
|
-
::ActiveRecord::ConnectionAdapters.send(:remove_const, :OracleAdapter)
|
26
|
-
end
|
27
|
-
if @old_oracle_adapter
|
28
|
-
::ActiveRecord::ConnectionAdapters::OracleAdapter = @old_oracle_adapter
|
29
|
-
@old_oracle_adapter = nil
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
describe "do not use count distinct" do
|
34
|
-
before(:all) do
|
35
|
-
schema_define do
|
36
|
-
create_table :job_history, :primary_key => [:employee_id, :start_date], :force => true do |t|
|
37
|
-
t.integer :employee_id
|
38
|
-
t.date :start_date
|
39
|
-
end
|
40
|
-
end
|
41
|
-
class ::JobHistory < ActiveRecord::Base
|
42
|
-
set_table_name "job_history"
|
43
|
-
set_primary_keys :employee_id, :start_date
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
after(:all) do
|
48
|
-
Object.send(:remove_const, 'JobHistory') if defined?(JobHistory)
|
49
|
-
schema_define do
|
50
|
-
drop_table :job_history
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
it "should tell ActiveRecord that count distinct is not supported" do
|
55
|
-
expect(ActiveRecord::Base.connection.supports_count_distinct?).to be_falsey
|
56
|
-
end
|
57
|
-
|
58
|
-
it "should execute correct SQL COUNT DISTINCT statement on table with composite primary keys" do
|
59
|
-
expect { JobHistory.count(:distinct => true) }.not_to raise_error
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
describe "table with LOB" do
|
64
|
-
before(:all) do
|
65
|
-
schema_define do
|
66
|
-
create_table :cpk_write_lobs_test, :primary_key => [:type_category, :date_value], :force => true do |t|
|
67
|
-
t.string :type_category, :limit => 15, :null => false
|
68
|
-
t.date :date_value, :null => false
|
69
|
-
t.text :results, :null => false
|
70
|
-
t.timestamps null: true
|
71
|
-
end
|
72
|
-
create_table :non_cpk_write_lobs_test, :force => true do |t|
|
73
|
-
t.date :date_value, :null => false
|
74
|
-
t.text :results, :null => false
|
75
|
-
t.timestamps null: true
|
76
|
-
end
|
77
|
-
end
|
78
|
-
class ::CpkWriteLobsTest < ActiveRecord::Base
|
79
|
-
set_table_name 'cpk_write_lobs_test'
|
80
|
-
set_primary_keys :type_category, :date_value
|
81
|
-
end
|
82
|
-
class ::NonCpkWriteLobsTest < ActiveRecord::Base
|
83
|
-
set_table_name 'non_cpk_write_lobs_test'
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
after(:all) do
|
88
|
-
schema_define do
|
89
|
-
drop_table :cpk_write_lobs_test
|
90
|
-
drop_table :non_cpk_write_lobs_test
|
91
|
-
end
|
92
|
-
Object.send(:remove_const, "CpkWriteLobsTest")
|
93
|
-
Object.send(:remove_const, "NonCpkWriteLobsTest")
|
94
|
-
end
|
95
|
-
|
96
|
-
it "should create new record in table with CPK and LOB" do
|
97
|
-
expect {
|
98
|
-
CpkWriteLobsTest.create(:type_category => 'AAA', :date_value => Date.today, :results => 'DATA '*10)
|
99
|
-
}.not_to raise_error
|
100
|
-
end
|
101
|
-
|
102
|
-
it "should create new record in table without CPK and with LOB" do
|
103
|
-
expect {
|
104
|
-
NonCpkWriteLobsTest.create(:date_value => Date.today, :results => 'DATA '*10)
|
105
|
-
}.not_to raise_error
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
# Other testing was done based on composite_primary_keys tests
|
110
|
-
|
111
|
-
end
|
112
|
-
|
113
|
-
end
|