activerecord-oracle_enhanced-adapter 7.0.3 → 7.1.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/History.md +24 -0
  3. data/README.md +0 -1
  4. data/VERSION +1 -1
  5. data/lib/active_record/connection_adapters/oracle_enhanced/column.rb +5 -0
  6. data/lib/active_record/connection_adapters/oracle_enhanced/connection.rb +1 -1
  7. data/lib/active_record/connection_adapters/oracle_enhanced/database_limits.rb +2 -2
  8. data/lib/active_record/connection_adapters/oracle_enhanced/database_statements.rb +26 -21
  9. data/lib/active_record/connection_adapters/oracle_enhanced/dbms_output.rb +15 -2
  10. data/lib/active_record/connection_adapters/oracle_enhanced/jdbc_connection.rb +9 -2
  11. data/lib/active_record/connection_adapters/oracle_enhanced/jdbc_quoting.rb +3 -3
  12. data/lib/active_record/connection_adapters/oracle_enhanced/oci_connection.rb +24 -15
  13. data/lib/active_record/connection_adapters/oracle_enhanced/oci_quoting.rb +3 -3
  14. data/lib/active_record/connection_adapters/oracle_enhanced/quoting.rb +2 -2
  15. data/lib/active_record/connection_adapters/oracle_enhanced/schema_creation.rb +1 -1
  16. data/lib/active_record/connection_adapters/oracle_enhanced/schema_definitions.rb +5 -0
  17. data/lib/active_record/connection_adapters/oracle_enhanced/schema_dumper.rb +1 -1
  18. data/lib/active_record/connection_adapters/oracle_enhanced/schema_statements.rb +22 -22
  19. data/lib/active_record/connection_adapters/oracle_enhanced/structure_dump.rb +17 -17
  20. data/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb +71 -28
  21. data/lib/activerecord-oracle_enhanced-adapter.rb +8 -0
  22. data/lib/arel/visitors/oracle.rb +6 -3
  23. data/lib/arel/visitors/oracle12.rb +6 -5
  24. data/lib/arel/visitors/oracle_common.rb +46 -0
  25. data/spec/active_record/connection_adapters/oracle_enhanced/connection_spec.rb +24 -5
  26. data/spec/active_record/connection_adapters/oracle_enhanced/database_tasks_spec.rb +7 -2
  27. data/spec/active_record/connection_adapters/oracle_enhanced/dbms_output_spec.rb +2 -2
  28. data/spec/active_record/connection_adapters/oracle_enhanced/schema_dumper_spec.rb +3 -0
  29. data/spec/active_record/connection_adapters/oracle_enhanced/schema_statements_spec.rb +25 -15
  30. data/spec/active_record/connection_adapters/oracle_enhanced/structure_dump_spec.rb +15 -18
  31. data/spec/active_record/connection_adapters/oracle_enhanced_adapter_spec.rb +14 -10
  32. data/spec/active_record/oracle_enhanced/type/boolean_spec.rb +2 -2
  33. data/spec/active_record/oracle_enhanced/type/character_string_spec.rb +24 -0
  34. data/spec/active_record/oracle_enhanced/type/dirty_spec.rb +4 -2
  35. data/spec/active_record/oracle_enhanced/type/integer_spec.rb +8 -0
  36. data/spec/active_record/oracle_enhanced/type/national_character_text_spec.rb +3 -3
  37. data/spec/active_record/oracle_enhanced/type/raw_spec.rb +15 -0
  38. data/spec/active_record/oracle_enhanced/type/text_spec.rb +18 -3
  39. data/spec/active_record/oracle_enhanced/type/timestamp_spec.rb +5 -1
  40. data/spec/spec_config.yaml.template +2 -2
  41. data/spec/spec_helper.rb +14 -3
  42. metadata +8 -6
@@ -87,5 +87,13 @@ describe "OracleEnhancedAdapter integer type detection based on attribute settin
87
87
  create_employee2
88
88
  expect(@employee2.is_manager).to be_a(Integer)
89
89
  end
90
+
91
+ it "should return Integer value from NUMBER(1) column if emulate_booleans is set to false" do
92
+ ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.emulate_booleans = false
93
+ ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.clear_type_map!
94
+ ActiveRecord::Base.clear_cache!
95
+ create_employee2
96
+ expect(@employee2.is_manager).to be_a(Integer)
97
+ end
90
98
  end
91
99
  end
@@ -79,7 +79,7 @@ describe "OracleEnhancedAdapter handling of NCLOB columns" do
79
79
  @employee.reload
80
80
  expect(@employee.comments).to eq(@nclob_data)
81
81
  @employee.comments = @nclob_data2
82
- expect(@employee.save).to eq(true)
82
+ expect(@employee.save).to be(true)
83
83
  @employee.reload
84
84
  expect(@employee.comments).to eq(@nclob_data)
85
85
  end
@@ -90,12 +90,12 @@ describe "OracleEnhancedAdapter handling of NCLOB columns" do
90
90
  comments: nil
91
91
  )
92
92
  expect(@employee.comments).to be_nil
93
- expect(@employee.save).to eq(true)
93
+ expect(@employee.save).to be(true)
94
94
  expect(@employee).to be_valid
95
95
  @employee.reload
96
96
  expect(@employee.comments).to be_nil
97
97
  @employee.comments = {}
98
- expect(@employee.save).to eq(true)
98
+ expect(@employee.save).to be(true)
99
99
  @employee.reload
100
100
  # should not set readonly
101
101
  expect(@employee.comments).to be_nil
@@ -119,4 +119,19 @@ describe "OracleEnhancedAdapter handling of RAW columns" do
119
119
  @employee.reload
120
120
  expect(@employee.binary_data).to eq(@binary_data)
121
121
  end
122
+
123
+ it "should allow equality on select" do
124
+ TestEmployee.delete_all
125
+ TestEmployee.create!(
126
+ first_name: "First",
127
+ last_name: "Last",
128
+ binary_data: @binary_data,
129
+ )
130
+ TestEmployee.create!(
131
+ first_name: "First1",
132
+ last_name: "Last1",
133
+ binary_data: @binary_data2,
134
+ )
135
+ expect(TestEmployee.where(binary_data: @binary_data)).to have_attributes(count: 1)
136
+ end
122
137
  end
@@ -78,7 +78,7 @@ describe "OracleEnhancedAdapter handling of CLOB columns" do
78
78
  @employee.reload
79
79
  expect(@employee.comments).to eq("initial")
80
80
  @employee.comments = "changed"
81
- expect(@employee.save).to eq(true)
81
+ expect(@employee.save).to be(true)
82
82
  @employee.reload
83
83
  expect(@employee.comments).to eq("initial")
84
84
  end
@@ -89,12 +89,12 @@ describe "OracleEnhancedAdapter handling of CLOB columns" do
89
89
  comments: nil
90
90
  )
91
91
  expect(@employee.comments).to be_nil
92
- expect(@employee.save).to eq(true)
92
+ expect(@employee.save).to be(true)
93
93
  expect(@employee).to be_valid
94
94
  @employee.reload
95
95
  expect(@employee.comments).to be_nil
96
96
  @employee.comments = {}
97
- expect(@employee.save).to eq(true)
97
+ expect(@employee.save).to be(true)
98
98
  @employee.reload
99
99
  # should not set readonly
100
100
  expect(@employee.comments).to be_nil
@@ -226,4 +226,19 @@ describe "OracleEnhancedAdapter handling of CLOB columns" do
226
226
  @employee.reload
227
227
  expect(@employee.comments).to eq(length: { is: 2 })
228
228
  end
229
+
230
+ it "should allow equality on select" do
231
+ search_data = "text search CLOB"
232
+ Test2Employee.create!(
233
+ first_name: "First",
234
+ last_name: "Last",
235
+ comments: search_data,
236
+ )
237
+ Test2Employee.create!(
238
+ first_name: "First1",
239
+ last_name: "Last1",
240
+ comments: "other data",
241
+ )
242
+ expect(Test2Employee.where(comments: search_data)).to have_attributes(count: 1)
243
+ end
229
244
  end
@@ -4,6 +4,10 @@ describe "OracleEnhancedAdapter timestamp with timezone support" do
4
4
  include SchemaSpecHelper
5
5
 
6
6
  before(:all) do
7
+ skip if ENV["DATABASE_SERVER_AND_CLIENT_VERSION_DO_NOT_MATCH"] == "true"
8
+ if ENV["DATABASE_VERSION"] == "11.2.0.2" && ENV["ORACLE_HOME"] == "/usr/lib/oracle/21/client64"
9
+ skip
10
+ end
7
11
  ActiveRecord.default_timezone = :local
8
12
  ActiveRecord::Base.establish_connection(CONNECTION_WITH_TIMEZONE_PARAMS)
9
13
  @conn = ActiveRecord::Base.connection
@@ -27,7 +31,7 @@ describe "OracleEnhancedAdapter timestamp with timezone support" do
27
31
  end
28
32
 
29
33
  after(:all) do
30
- @conn.drop_table :test_employees, if_exists: true
34
+ @conn.drop_table :test_employees, if_exists: true rescue nil
31
35
  ActiveRecord.default_timezone = :utc
32
36
  end
33
37
 
@@ -1,11 +1,11 @@
1
1
  # copy this file to spec/spec_config.yaml and set appropriate values
2
2
  # you can also use environment variables, see spec_helper.rb
3
3
  database:
4
- name: 'orcl'
4
+ name: 'FREEPDB1'
5
5
  host: '127.0.0.1'
6
6
  port: 1521
7
7
  user: 'oracle_enhanced'
8
8
  password: 'oracle_enhanced'
9
- sys_password: 'admin'
9
+ sys_password: 'oracle'
10
10
  non_default_tablespace: 'SYSTEM'
11
11
  timezone: 'Europe/Riga'
data/spec/spec_helper.rb CHANGED
@@ -57,6 +57,8 @@ module LoggerSpecHelper
57
57
  end
58
58
 
59
59
  class MockLogger
60
+ LEVELS = %i[debug info warn error fatal unknown]
61
+
60
62
  attr_reader :flush_count
61
63
 
62
64
  def initialize
@@ -64,13 +66,22 @@ module LoggerSpecHelper
64
66
  @logged = Hash.new { |h, k| h[k] = [] }
65
67
  end
66
68
 
67
- # used in AtiveRecord 2.x
69
+ # used in ActiveRecord 2.x
68
70
  def debug?
69
71
  true
70
72
  end
71
73
 
72
- def method_missing(level, message)
73
- @logged[level] << message
74
+ def level
75
+ 0
76
+ end
77
+
78
+ def method_missing(*args)
79
+ if LEVELS.include?(args[0])
80
+ level, message = args
81
+ @logged[level] << message
82
+ else
83
+ super
84
+ end
74
85
  end
75
86
 
76
87
  def logged(level)
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: 7.0.3
4
+ version: 7.1.0.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Raimonds Simanovskis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-10 00:00:00.000000000 Z
11
+ date: 2024-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 7.0.0
19
+ version: 7.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: 7.0.0
26
+ version: 7.1.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: ruby-plsql
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -102,6 +102,7 @@ files:
102
102
  - lib/activerecord-oracle_enhanced-adapter.rb
103
103
  - lib/arel/visitors/oracle.rb
104
104
  - lib/arel/visitors/oracle12.rb
105
+ - lib/arel/visitors/oracle_common.rb
105
106
  - spec/active_record/connection_adapters/emulation/oracle_adapter_spec.rb
106
107
  - spec/active_record/connection_adapters/oracle_enhanced/connection_spec.rb
107
108
  - spec/active_record/connection_adapters/oracle_enhanced/context_index_spec.rb
@@ -136,7 +137,8 @@ files:
136
137
  homepage: http://github.com/rsim/oracle-enhanced
137
138
  licenses:
138
139
  - MIT
139
- metadata: {}
140
+ metadata:
141
+ rubygems_mfa_required: 'true'
140
142
  post_install_message:
141
143
  rdoc_options: []
142
144
  require_paths:
@@ -152,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
152
154
  - !ruby/object:Gem::Version
153
155
  version: 1.8.11
154
156
  requirements: []
155
- rubygems_version: 3.4.10
157
+ rubygems_version: 3.5.16
156
158
  signing_key:
157
159
  specification_version: 4
158
160
  summary: Oracle enhanced adapter for ActiveRecord