rsim-activerecord-oracle_enhanced-adapter 1.1.9.92 → 1.1.9.93
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Manifest.txt +2 -0
- data/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb +4 -0
- data/lib/active_record/connection_adapters/oracle_enhanced_core_ext.rb +64 -0
- data/lib/active_record/connection_adapters/oracle_enhanced_jdbc_connection.rb +0 -26
- data/lib/active_record/connection_adapters/oracle_enhanced_oci_connection.rb +27 -1
- data/lib/active_record/connection_adapters/oracle_enhanced_procedures.rb +2 -1
- data/oracle-enhanced.gemspec +3 -1
- data/spec/active_record/connection_adapters/oracle_enhanced_adapter_spec.rb +26 -26
- data/spec/active_record/connection_adapters/oracle_enhanced_core_ext_spec.rb +40 -0
- data/spec/active_record/connection_adapters/oracle_enhanced_cpk_spec.rb +10 -2
- data/spec/active_record/connection_adapters/oracle_enhanced_data_types_spec.rb +11 -11
- data/spec/active_record/connection_adapters/oracle_enhanced_procedures_spec.rb +1 -1
- data/spec/spec_helper.rb +3 -0
- metadata +3 -1
data/Manifest.txt
CHANGED
@@ -5,6 +5,7 @@ lib/active_record/connection_adapters/emulation/oracle_adapter.rb
|
|
5
5
|
lib/active_record/connection_adapters/oracle_enhanced.rake
|
6
6
|
lib/active_record/connection_adapters/oracle_enhanced_adapter.rb
|
7
7
|
lib/active_record/connection_adapters/oracle_enhanced_connection.rb
|
8
|
+
lib/active_record/connection_adapters/oracle_enhanced_core_ext.rb
|
8
9
|
lib/active_record/connection_adapters/oracle_enhanced_cpk.rb
|
9
10
|
lib/active_record/connection_adapters/oracle_enhanced_dirty.rb
|
10
11
|
lib/active_record/connection_adapters/oracle_enhanced_jdbc_connection.rb
|
@@ -15,6 +16,7 @@ lib/active_record/connection_adapters/oracle_enhanced_tasks.rb
|
|
15
16
|
lib/active_record/connection_adapters/oracle_enhanced_version.rb
|
16
17
|
spec/active_record/connection_adapters/oracle_enhanced_adapter_spec.rb
|
17
18
|
spec/active_record/connection_adapters/oracle_enhanced_connection_spec.rb
|
19
|
+
spec/active_record/connection_adapters/oracle_enhanced_core_ext_spec.rb
|
18
20
|
spec/active_record/connection_adapters/oracle_enhanced_cpk_spec.rb
|
19
21
|
spec/active_record/connection_adapters/oracle_enhanced_data_types_spec.rb
|
20
22
|
spec/active_record/connection_adapters/oracle_enhanced_dirty_spec.rb
|
@@ -980,3 +980,7 @@ end if defined?(RAILS_ROOT)
|
|
980
980
|
|
981
981
|
# handles quoting of oracle reserved words
|
982
982
|
require 'active_record/connection_adapters/oracle_enhanced_reserved_words'
|
983
|
+
|
984
|
+
# add BigDecimal#to_d, Fixnum#to_d and Bignum#to_d methods if not already present
|
985
|
+
require 'active_record/connection_adapters/oracle_enhanced_core_ext'
|
986
|
+
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require "bigdecimal"
|
2
|
+
unless BigDecimal.instance_methods.include?("to_d")
|
3
|
+
BigDecimal.class_eval do
|
4
|
+
def to_d
|
5
|
+
self
|
6
|
+
end
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
unless Bignum.instance_methods.include?("to_d")
|
11
|
+
Bignum.class_eval do
|
12
|
+
def to_d
|
13
|
+
BigDecimal.new(self.to_s)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
unless Fixnum.instance_methods.include?("to_d")
|
19
|
+
Fixnum.class_eval do
|
20
|
+
def to_d
|
21
|
+
BigDecimal.new(self.to_s)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
# Add Unicode aware String#upcase and String#downcase methods when mb_chars method is called
|
27
|
+
if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'ruby' && RUBY_VERSION >= '1.9'
|
28
|
+
begin
|
29
|
+
gem "unicode_utils", ">=1.0.0"
|
30
|
+
require "unicode_utils/upcase"
|
31
|
+
require "unicode_utils/downcase"
|
32
|
+
|
33
|
+
module ActiveRecord
|
34
|
+
module ConnectionAdapters
|
35
|
+
module OracleEnhancedUnicodeString
|
36
|
+
def upcase
|
37
|
+
UnicodeUtils.upcase(self)
|
38
|
+
end
|
39
|
+
|
40
|
+
def downcase
|
41
|
+
UnicodeUtils.downcase(self)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
class String
|
48
|
+
def mb_chars
|
49
|
+
self.extend(ActiveRecord::ConnectionAdapters::OracleEnhancedUnicodeString)
|
50
|
+
self
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
rescue LoadError
|
55
|
+
warning_message = "WARNING: Please install unicode_utils gem to support Unicode aware upcase and downcase for String#mb_chars"
|
56
|
+
if defined?(RAILS_DEFAULT_LOGGER)
|
57
|
+
RAILS_DEFAULT_LOGGER.warn warning_message
|
58
|
+
else
|
59
|
+
STDERR.puts warning_message
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
|
64
|
+
end
|
@@ -350,29 +350,3 @@ module ActiveRecord
|
|
350
350
|
|
351
351
|
end
|
352
352
|
end
|
353
|
-
|
354
|
-
# add BigDecimal#to_d, Fixnum#to_d and Bignum#to_d methods if not already present
|
355
|
-
require "bigdecimal"
|
356
|
-
unless BigDecimal.instance_methods.include?("to_d")
|
357
|
-
BigDecimal.class_eval do
|
358
|
-
def to_d
|
359
|
-
self
|
360
|
-
end
|
361
|
-
end
|
362
|
-
end
|
363
|
-
|
364
|
-
unless Bignum.instance_methods.include?("to_d")
|
365
|
-
Bignum.class_eval do
|
366
|
-
def to_d
|
367
|
-
BigDecimal.new(self.to_s)
|
368
|
-
end
|
369
|
-
end
|
370
|
-
end
|
371
|
-
|
372
|
-
unless Fixnum.instance_methods.include?("to_d")
|
373
|
-
Fixnum.class_eval do
|
374
|
-
def to_d
|
375
|
-
BigDecimal.new(self.to_s)
|
376
|
-
end
|
377
|
-
end
|
378
|
-
end
|
@@ -94,7 +94,15 @@ module ActiveRecord
|
|
94
94
|
hash[col] =
|
95
95
|
case row[i]
|
96
96
|
when OCI8::LOB
|
97
|
-
name == 'Writable Large Object'
|
97
|
+
if name == 'Writable Large Object'
|
98
|
+
row[i]
|
99
|
+
else
|
100
|
+
data = row[i].read
|
101
|
+
# In Ruby 1.9.1 always change encoding to ASCII-8BIT for binaries
|
102
|
+
data.force_encoding('ASCII-8BIT') if data.respond_to?(:force_encoding) && row[i].is_a?(OCI8::BLOB)
|
103
|
+
data
|
104
|
+
end
|
105
|
+
# ruby-oci8 1.0 returns OraDate
|
98
106
|
when OraDate
|
99
107
|
d = row[i]
|
100
108
|
# RSI: added emulate_dates_by_column_name functionality
|
@@ -112,6 +120,20 @@ module ActiveRecord
|
|
112
120
|
::DateTime.civil(d.year, d.month, d.day, d.hour, d.minute, d.second, offset)
|
113
121
|
end
|
114
122
|
end
|
123
|
+
# ruby-oci8 2.0 returns Time or DateTime
|
124
|
+
when Time, DateTime
|
125
|
+
d = row[i]
|
126
|
+
if OracleEnhancedAdapter.emulate_dates && (d.hour == 0 && d.min == 0 && d.sec == 0)
|
127
|
+
d.to_date
|
128
|
+
else
|
129
|
+
# recreate Time or DateTime using Base.default_timezone
|
130
|
+
begin
|
131
|
+
Time.send(Base.default_timezone, d.year, d.month, d.day, d.hour, d.min, d.sec)
|
132
|
+
rescue
|
133
|
+
offset = Base.default_timezone.to_sym == :local ? ::DateTime.local_offset : 0
|
134
|
+
::DateTime.civil(d.year, d.month, d.day, d.hour, d.min, d.sec, offset)
|
135
|
+
end
|
136
|
+
end
|
115
137
|
# RSI: added emulate_integers_by_column_name functionality
|
116
138
|
when Float
|
117
139
|
n = row[i]
|
@@ -120,6 +142,10 @@ module ActiveRecord
|
|
120
142
|
else
|
121
143
|
n
|
122
144
|
end
|
145
|
+
# ruby-oci8 2.0 returns OraNumber - convert it to Integer or BigDecimal
|
146
|
+
when OraNumber
|
147
|
+
n = row[i]
|
148
|
+
n == (n_to_i = n.to_i) ? n_to_i : BigDecimal.new(n.to_s)
|
123
149
|
else row[i]
|
124
150
|
end unless col == 'raw_rnum_'
|
125
151
|
end
|
@@ -40,7 +40,8 @@ module ActiveRecord #:nodoc:
|
|
40
40
|
base.instance_eval do
|
41
41
|
alias_method_chain :create, :custom_method
|
42
42
|
# insert after dirty checking in Rails 2.1
|
43
|
-
|
43
|
+
# in Ruby 1.9 methods names are returned as symbols
|
44
|
+
if private_instance_methods.include?('update_without_dirty') || private_instance_methods.include?(:update_without_dirty)
|
44
45
|
alias_method :update_without_custom_method, :update_without_dirty
|
45
46
|
alias_method :update_without_dirty, :update_with_custom_method
|
46
47
|
else
|
data/oracle-enhanced.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{activerecord-oracle_enhanced-adapter}
|
5
|
-
s.version = "1.1.9.
|
5
|
+
s.version = "1.1.9.93"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Raimonds Simanovskis"]
|
@@ -15,6 +15,7 @@ Gem::Specification.new do |s|
|
|
15
15
|
"lib/active_record/connection_adapters/oracle_enhanced.rake",
|
16
16
|
"lib/active_record/connection_adapters/oracle_enhanced_adapter.rb",
|
17
17
|
"lib/active_record/connection_adapters/oracle_enhanced_connection.rb",
|
18
|
+
"lib/active_record/connection_adapters/oracle_enhanced_core_ext.rb",
|
18
19
|
"lib/active_record/connection_adapters/oracle_enhanced_cpk.rb",
|
19
20
|
"lib/active_record/connection_adapters/oracle_enhanced_dirty.rb",
|
20
21
|
"lib/active_record/connection_adapters/oracle_enhanced_jdbc_connection.rb",
|
@@ -26,6 +27,7 @@ Gem::Specification.new do |s|
|
|
26
27
|
"oracle-enhanced.gemspec",
|
27
28
|
"spec/active_record/connection_adapters/oracle_enhanced_adapter_spec.rb",
|
28
29
|
"spec/active_record/connection_adapters/oracle_enhanced_connection_spec.rb",
|
30
|
+
"spec/active_record/connection_adapters/oracle_enhanced_core_ext_spec.rb",
|
29
31
|
"spec/active_record/connection_adapters/oracle_enhanced_cpk_spec.rb",
|
30
32
|
"spec/active_record/connection_adapters/oracle_enhanced_data_types_spec.rb",
|
31
33
|
"spec/active_record/connection_adapters/oracle_enhanced_dirty_spec.rb",
|
@@ -128,9 +128,9 @@ describe "OracleEnhancedAdapter database session store" do
|
|
128
128
|
INCREMENT BY 1 START WITH 10040 CACHE 20 NOORDER NOCYCLE
|
129
129
|
SQL
|
130
130
|
if ENV['RAILS_GEM_VERSION'] >= '2.3'
|
131
|
-
|
131
|
+
@session_class = ActiveRecord::SessionStore::Session
|
132
132
|
else
|
133
|
-
|
133
|
+
@session_class = CGI::Session::ActiveRecordStore::Session
|
134
134
|
end
|
135
135
|
end
|
136
136
|
|
@@ -144,29 +144,29 @@ describe "OracleEnhancedAdapter database session store" do
|
|
144
144
|
end
|
145
145
|
|
146
146
|
it "should save session data" do
|
147
|
-
@session =
|
147
|
+
@session = @session_class.new :session_id => "111111", :data => "something" #, :updated_at => Time.now
|
148
148
|
@session.save!
|
149
|
-
@session =
|
149
|
+
@session = @session_class.find_by_session_id("111111")
|
150
150
|
@session.data.should == "something"
|
151
151
|
end
|
152
152
|
|
153
153
|
it "should change session data when partial updates enabled" do
|
154
|
-
return pending("Not in this ActiveRecord version") unless
|
155
|
-
|
156
|
-
@session =
|
154
|
+
return pending("Not in this ActiveRecord version") unless @session_class.respond_to?(:partial_updates=)
|
155
|
+
@session_class.partial_updates = true
|
156
|
+
@session = @session_class.new :session_id => "222222", :data => "something" #, :updated_at => Time.now
|
157
157
|
@session.save!
|
158
|
-
@session =
|
158
|
+
@session = @session_class.find_by_session_id("222222")
|
159
159
|
@session.data = "other thing"
|
160
160
|
@session.save!
|
161
161
|
# second save should call again blob writing callback
|
162
162
|
@session.save!
|
163
|
-
@session =
|
163
|
+
@session = @session_class.find_by_session_id("222222")
|
164
164
|
@session.data.should == "other thing"
|
165
165
|
end
|
166
166
|
|
167
167
|
it "should have one enhanced_write_lobs callback" do
|
168
|
-
return pending("Not in this ActiveRecord version") unless
|
169
|
-
|
168
|
+
return pending("Not in this ActiveRecord version") unless @session_class.respond_to?(:after_save_callback_chain)
|
169
|
+
@session_class.after_save_callback_chain.select{|cb| cb.method == :enhanced_write_lobs}.should have(1).record
|
170
170
|
end
|
171
171
|
|
172
172
|
it "should not set sessions table session_id column type as integer if emulate_integers_by_column_name is true" do
|
@@ -214,14 +214,14 @@ describe "OracleEnhancedAdapter ignore specified table columns" do
|
|
214
214
|
end
|
215
215
|
|
216
216
|
it "should ignore specified table columns" do
|
217
|
-
class TestEmployee < ActiveRecord::Base
|
217
|
+
class ::TestEmployee < ActiveRecord::Base
|
218
218
|
ignore_table_columns :phone_number, :hire_date
|
219
219
|
end
|
220
220
|
TestEmployee.connection.columns('test_employees').select{|c| ['phone_number','hire_date'].include?(c.name) }.should be_empty
|
221
221
|
end
|
222
222
|
|
223
223
|
it "should ignore specified table columns specified in several lines" do
|
224
|
-
class TestEmployee < ActiveRecord::Base
|
224
|
+
class ::TestEmployee < ActiveRecord::Base
|
225
225
|
ignore_table_columns :phone_number
|
226
226
|
ignore_table_columns :hire_date
|
227
227
|
end
|
@@ -229,7 +229,7 @@ describe "OracleEnhancedAdapter ignore specified table columns" do
|
|
229
229
|
end
|
230
230
|
|
231
231
|
it "should not ignore unspecified table columns" do
|
232
|
-
class TestEmployee < ActiveRecord::Base
|
232
|
+
class ::TestEmployee < ActiveRecord::Base
|
233
233
|
ignore_table_columns :phone_number, :hire_date
|
234
234
|
end
|
235
235
|
TestEmployee.connection.columns('test_employees').select{|c| c.name == 'email' }.should_not be_empty
|
@@ -253,10 +253,10 @@ describe "OracleEnhancedAdapter table and sequence creation with non-default pri
|
|
253
253
|
end
|
254
254
|
end
|
255
255
|
end
|
256
|
-
class Keyboard < ActiveRecord::Base
|
256
|
+
class ::Keyboard < ActiveRecord::Base
|
257
257
|
set_primary_key :key_number
|
258
258
|
end
|
259
|
-
class IdKeyboard < ActiveRecord::Base
|
259
|
+
class ::IdKeyboard < ActiveRecord::Base
|
260
260
|
end
|
261
261
|
end
|
262
262
|
|
@@ -285,7 +285,7 @@ describe "OracleEnhancedAdapter without composite_primary_keys" do
|
|
285
285
|
before(:all) do
|
286
286
|
ActiveRecord::Base.establish_connection(CONNECTION_PARAMS)
|
287
287
|
Object.send(:remove_const, 'CompositePrimaryKeys') if defined?(CompositePrimaryKeys)
|
288
|
-
class Employee < ActiveRecord::Base
|
288
|
+
class ::Employee < ActiveRecord::Base
|
289
289
|
set_primary_key :employee_id
|
290
290
|
end
|
291
291
|
end
|
@@ -342,7 +342,7 @@ describe "OracleEnhancedAdapter sequence creation parameters" do
|
|
342
342
|
ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.default_sequence_start_value.should == 10000
|
343
343
|
|
344
344
|
create_test_employees_table
|
345
|
-
class TestEmployee < ActiveRecord::Base; end
|
345
|
+
class ::TestEmployee < ActiveRecord::Base; end
|
346
346
|
|
347
347
|
employee = TestEmployee.create!
|
348
348
|
employee.id.should == 10000
|
@@ -352,7 +352,7 @@ describe "OracleEnhancedAdapter sequence creation parameters" do
|
|
352
352
|
ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.default_sequence_start_value = 1
|
353
353
|
|
354
354
|
create_test_employees_table
|
355
|
-
class TestEmployee < ActiveRecord::Base; end
|
355
|
+
class ::TestEmployee < ActiveRecord::Base; end
|
356
356
|
|
357
357
|
employee = TestEmployee.create!
|
358
358
|
employee.id.should == 1
|
@@ -360,7 +360,7 @@ describe "OracleEnhancedAdapter sequence creation parameters" do
|
|
360
360
|
|
361
361
|
it "should use sequence start value from table definition" do
|
362
362
|
create_test_employees_table(10)
|
363
|
-
class TestEmployee < ActiveRecord::Base; end
|
363
|
+
class ::TestEmployee < ActiveRecord::Base; end
|
364
364
|
|
365
365
|
employee = TestEmployee.create!
|
366
366
|
employee.id.should == 10
|
@@ -368,7 +368,7 @@ describe "OracleEnhancedAdapter sequence creation parameters" do
|
|
368
368
|
|
369
369
|
it "should use sequence start value and other options from table definition" do
|
370
370
|
create_test_employees_table("100 NOCACHE INCREMENT BY 10")
|
371
|
-
class TestEmployee < ActiveRecord::Base; end
|
371
|
+
class ::TestEmployee < ActiveRecord::Base; end
|
372
372
|
|
373
373
|
employee = TestEmployee.create!
|
374
374
|
employee.id.should == 100
|
@@ -409,7 +409,7 @@ describe "OracleEnhancedAdapter table and column comments" do
|
|
409
409
|
it "should create table with table comment" do
|
410
410
|
table_comment = "Test Employees"
|
411
411
|
create_test_employees_table(table_comment)
|
412
|
-
class TestEmployee < ActiveRecord::Base; end
|
412
|
+
class ::TestEmployee < ActiveRecord::Base; end
|
413
413
|
|
414
414
|
@conn.table_comment("test_employees").should == table_comment
|
415
415
|
TestEmployee.table_comment.should == table_comment
|
@@ -418,7 +418,7 @@ describe "OracleEnhancedAdapter table and column comments" do
|
|
418
418
|
it "should create table with columns comment" do
|
419
419
|
column_comments = {:first_name => "Given Name", :last_name => "Surname"}
|
420
420
|
create_test_employees_table(nil, column_comments)
|
421
|
-
class TestEmployee < ActiveRecord::Base; end
|
421
|
+
class ::TestEmployee < ActiveRecord::Base; end
|
422
422
|
|
423
423
|
[:first_name, :last_name].each do |attr|
|
424
424
|
@conn.column_comment("test_employees", attr.to_s).should == column_comments[attr]
|
@@ -433,7 +433,7 @@ describe "OracleEnhancedAdapter table and column comments" do
|
|
433
433
|
table_comment = "Test Employees"
|
434
434
|
column_comments = {:first_name => "Given Name", :last_name => "Surname"}
|
435
435
|
create_test_employees_table(table_comment, column_comments)
|
436
|
-
class TestEmployee < ActiveRecord::Base; end
|
436
|
+
class ::TestEmployee < ActiveRecord::Base; end
|
437
437
|
|
438
438
|
@conn.table_comment(TestEmployee.table_name).should == table_comment
|
439
439
|
TestEmployee.table_comment.should == table_comment
|
@@ -477,7 +477,7 @@ describe "OracleEnhancedAdapter column quoting" do
|
|
477
477
|
|
478
478
|
it "should allow creation of a table with oracle reserved words as column names" do
|
479
479
|
create_test_reserved_words_table
|
480
|
-
class TestReservedWord < ActiveRecord::Base; end
|
480
|
+
class ::TestReservedWord < ActiveRecord::Base; end
|
481
481
|
|
482
482
|
[:varchar2, :integer].each do |attr|
|
483
483
|
TestReservedWord.columns_hash[attr.to_s].name.should == attr.to_s
|
@@ -542,7 +542,7 @@ describe "OracleEnhancedAdapter table quoting" do
|
|
542
542
|
|
543
543
|
it "should allow creation of a table with non alphanumeric characters" do
|
544
544
|
create_warehouse_things_table
|
545
|
-
class WarehouseThing < ActiveRecord::Base
|
545
|
+
class ::WarehouseThing < ActiveRecord::Base
|
546
546
|
set_table_name "warehouse-things"
|
547
547
|
end
|
548
548
|
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require File.dirname(__FILE__) + '/../../spec_helper.rb'
|
4
|
+
|
5
|
+
describe "OracleEnhancedAdapter to_d method" do
|
6
|
+
it "BigDecimal#to_d returns the same decimal number" do
|
7
|
+
d = BigDecimal.new("12345678901234567890.0123456789")
|
8
|
+
d.to_d.should == d
|
9
|
+
end
|
10
|
+
|
11
|
+
it "Bignum#to_d translates large integer to decimal" do
|
12
|
+
n = 12345678901234567890
|
13
|
+
n.to_d.should == BigDecimal.new(n.to_s)
|
14
|
+
end
|
15
|
+
|
16
|
+
it "Fixnum#to_d translates small integer to decimal" do
|
17
|
+
n = 123456
|
18
|
+
n.to_d.should == BigDecimal.new(n.to_s)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
if ENV['RAILS_GEM_VERSION'] >= '2.3'
|
23
|
+
|
24
|
+
describe "OracleEnhancedAdapter Unicode aware upcase and downcase" do
|
25
|
+
before(:all) do
|
26
|
+
@down = "āčēģīķļņšūž"
|
27
|
+
@up = "ĀČĒĢĪĶĻŅŠŪŽ"
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should translate Unicode string to upcase" do
|
31
|
+
@down.mb_chars.upcase.to_s.should == @up
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should translate Unicode string to downcase" do
|
35
|
+
@up.mb_chars.downcase.to_s.should == @down
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
@@ -3,9 +3,13 @@ require File.dirname(__FILE__) + '/../../spec_helper.rb'
|
|
3
3
|
describe "OracleEnhancedAdapter composite_primary_keys support" do
|
4
4
|
|
5
5
|
before(:all) do
|
6
|
-
|
6
|
+
if defined?(ActiveRecord::ConnectionAdapters::OracleAdapter)
|
7
|
+
@old_oracle_adapter = ActiveRecord::ConnectionAdapters::OracleAdapter
|
8
|
+
ActiveRecord::ConnectionAdapters.send(:remove_const, :OracleAdapter)
|
9
|
+
end
|
7
10
|
ActiveRecord::Base.establish_connection(CONNECTION_PARAMS)
|
8
|
-
|
11
|
+
require 'composite_primary_keys'
|
12
|
+
class ::JobHistory < ActiveRecord::Base
|
9
13
|
set_table_name "job_history"
|
10
14
|
set_primary_keys :employee_id, :start_date
|
11
15
|
end
|
@@ -14,6 +18,10 @@ describe "OracleEnhancedAdapter composite_primary_keys support" do
|
|
14
18
|
after(:all) do
|
15
19
|
Object.send(:remove_const, 'CompositePrimaryKeys') if defined?(CompositePrimaryKeys)
|
16
20
|
Object.send(:remove_const, 'JobHistory') if defined?(JobHistory)
|
21
|
+
if @old_oracle_adapter
|
22
|
+
ActiveRecord::ConnectionAdapters.send(:remove_const, :OracleAdapter)
|
23
|
+
ActiveRecord::ConnectionAdapters::OracleAdapter = @old_oracle_adapter
|
24
|
+
end
|
17
25
|
end
|
18
26
|
|
19
27
|
it "should tell ActiveRecord that count distinct is not supported" do
|
@@ -79,7 +79,7 @@ describe "OracleEnhancedAdapter date type detection based on column names" do
|
|
79
79
|
ActiveRecord::Base.connection.clear_types_for_columns
|
80
80
|
ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.emulate_dates_by_column_name = false
|
81
81
|
ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.emulate_dates = false
|
82
|
-
class TestEmployee < ActiveRecord::Base
|
82
|
+
class ::TestEmployee < ActiveRecord::Base
|
83
83
|
set_table_name "hr.test_employees"
|
84
84
|
set_primary_key :employee_id
|
85
85
|
end
|
@@ -121,7 +121,7 @@ describe "OracleEnhancedAdapter date type detection based on column names" do
|
|
121
121
|
end
|
122
122
|
|
123
123
|
it "should return Date value from DATE column if emulate_dates_by_column_name is false but column is defined as date" do
|
124
|
-
class TestEmployee < ActiveRecord::Base
|
124
|
+
class ::TestEmployee < ActiveRecord::Base
|
125
125
|
set_date_columns :hire_date
|
126
126
|
end
|
127
127
|
ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.emulate_dates_by_column_name = false
|
@@ -130,7 +130,7 @@ describe "OracleEnhancedAdapter date type detection based on column names" do
|
|
130
130
|
end
|
131
131
|
|
132
132
|
it "should return Time value from DATE column if emulate_dates_by_column_name is true but column is defined as datetime" do
|
133
|
-
class TestEmployee < ActiveRecord::Base
|
133
|
+
class ::TestEmployee < ActiveRecord::Base
|
134
134
|
set_datetime_columns :hire_date
|
135
135
|
end
|
136
136
|
ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.emulate_dates_by_column_name = true
|
@@ -225,7 +225,7 @@ describe "OracleEnhancedAdapter integer type detection based on column names" do
|
|
225
225
|
|
226
226
|
describe "/ NUMBER values from ActiveRecord model" do
|
227
227
|
before(:each) do
|
228
|
-
class Test2Employee < ActiveRecord::Base
|
228
|
+
class ::Test2Employee < ActiveRecord::Base
|
229
229
|
end
|
230
230
|
end
|
231
231
|
|
@@ -369,7 +369,7 @@ describe "OracleEnhancedAdapter boolean type detection based on string column ty
|
|
369
369
|
describe "/ VARCHAR2 boolean values from ActiveRecord model" do
|
370
370
|
before(:each) do
|
371
371
|
ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.emulate_booleans_from_strings = false
|
372
|
-
class Test3Employee < ActiveRecord::Base
|
372
|
+
class ::Test3Employee < ActiveRecord::Base
|
373
373
|
end
|
374
374
|
end
|
375
375
|
|
@@ -420,7 +420,7 @@ describe "OracleEnhancedAdapter boolean type detection based on string column ty
|
|
420
420
|
|
421
421
|
it "should return boolean value from VARCHAR2 boolean column if column specified in set_boolean_columns" do
|
422
422
|
ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.emulate_booleans_from_strings = true
|
423
|
-
class Test3Employee < ActiveRecord::Base
|
423
|
+
class ::Test3Employee < ActiveRecord::Base
|
424
424
|
set_boolean_columns :test_boolean
|
425
425
|
end
|
426
426
|
create_employee3(:test_boolean => true)
|
@@ -482,7 +482,7 @@ describe "OracleEnhancedAdapter timestamp with timezone support" do
|
|
482
482
|
|
483
483
|
describe "/ TIMESTAMP WITH TIME ZONE values from ActiveRecord model" do
|
484
484
|
before(:all) do
|
485
|
-
class TestEmployee < ActiveRecord::Base
|
485
|
+
class ::TestEmployee < ActiveRecord::Base
|
486
486
|
set_primary_key :employee_id
|
487
487
|
end
|
488
488
|
end
|
@@ -582,7 +582,7 @@ describe "OracleEnhancedAdapter date and timestamp with different NLS date forma
|
|
582
582
|
before(:each) do
|
583
583
|
ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.emulate_dates = false
|
584
584
|
ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.emulate_dates_by_column_name = false
|
585
|
-
class TestEmployee < ActiveRecord::Base
|
585
|
+
class ::TestEmployee < ActiveRecord::Base
|
586
586
|
set_primary_key :employee_id
|
587
587
|
end
|
588
588
|
@today = Date.new(2008,6,28)
|
@@ -666,7 +666,7 @@ describe "OracleEnhancedAdapter assign string to :date and :datetime columns" do
|
|
666
666
|
CREATE SEQUENCE test_employees_seq MINVALUE 1
|
667
667
|
INCREMENT BY 1 CACHE 20 NOORDER NOCYCLE
|
668
668
|
SQL
|
669
|
-
class TestEmployee < ActiveRecord::Base
|
669
|
+
class ::TestEmployee < ActiveRecord::Base
|
670
670
|
set_primary_key :employee_id
|
671
671
|
end
|
672
672
|
end
|
@@ -794,7 +794,7 @@ describe "OracleEnhancedAdapter handling of CLOB columns" do
|
|
794
794
|
CREATE SEQUENCE test_employees_seq MINVALUE 1
|
795
795
|
INCREMENT BY 1 CACHE 20 NOORDER NOCYCLE
|
796
796
|
SQL
|
797
|
-
class TestEmployee < ActiveRecord::Base
|
797
|
+
class ::TestEmployee < ActiveRecord::Base
|
798
798
|
set_primary_key :employee_id
|
799
799
|
end
|
800
800
|
end
|
@@ -859,7 +859,7 @@ describe "OracleEnhancedAdapter handling of BLOB columns" do
|
|
859
859
|
end
|
860
860
|
|
861
861
|
before(:each) do
|
862
|
-
class TestEmployee < ActiveRecord::Base
|
862
|
+
class ::TestEmployee < ActiveRecord::Base
|
863
863
|
set_primary_key :employee_id
|
864
864
|
end
|
865
865
|
end
|
@@ -92,7 +92,7 @@ describe "OracleEnhancedAdapter custom methods for create, update and destroy" d
|
|
92
92
|
|
93
93
|
ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.emulate_dates_by_column_name = true
|
94
94
|
|
95
|
-
class TestEmployee < ActiveRecord::Base
|
95
|
+
class ::TestEmployee < ActiveRecord::Base
|
96
96
|
set_primary_key :employee_id
|
97
97
|
|
98
98
|
validates_presence_of :first_name, :last_name, :hire_date
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rsim-activerecord-oracle_enhanced-adapter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.9.
|
4
|
+
version: 1.1.9.93
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Raimonds Simanovskis
|
@@ -43,6 +43,7 @@ files:
|
|
43
43
|
- lib/active_record/connection_adapters/oracle_enhanced.rake
|
44
44
|
- lib/active_record/connection_adapters/oracle_enhanced_adapter.rb
|
45
45
|
- lib/active_record/connection_adapters/oracle_enhanced_connection.rb
|
46
|
+
- lib/active_record/connection_adapters/oracle_enhanced_core_ext.rb
|
46
47
|
- lib/active_record/connection_adapters/oracle_enhanced_cpk.rb
|
47
48
|
- lib/active_record/connection_adapters/oracle_enhanced_dirty.rb
|
48
49
|
- lib/active_record/connection_adapters/oracle_enhanced_jdbc_connection.rb
|
@@ -54,6 +55,7 @@ files:
|
|
54
55
|
- oracle-enhanced.gemspec
|
55
56
|
- spec/active_record/connection_adapters/oracle_enhanced_adapter_spec.rb
|
56
57
|
- spec/active_record/connection_adapters/oracle_enhanced_connection_spec.rb
|
58
|
+
- spec/active_record/connection_adapters/oracle_enhanced_core_ext_spec.rb
|
57
59
|
- spec/active_record/connection_adapters/oracle_enhanced_cpk_spec.rb
|
58
60
|
- spec/active_record/connection_adapters/oracle_enhanced_data_types_spec.rb
|
59
61
|
- spec/active_record/connection_adapters/oracle_enhanced_dirty_spec.rb
|