pmacs-activerecord-oracle_enhanced-adapter 1.4.2.rc1 → 1.5.5.1

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.
Files changed (44) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +11 -40
  3. data/History.md +170 -0
  4. data/README.md +61 -5
  5. data/Rakefile +1 -0
  6. data/VERSION +1 -1
  7. data/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb +330 -161
  8. data/lib/active_record/connection_adapters/oracle_enhanced_column.rb +48 -8
  9. data/lib/active_record/connection_adapters/oracle_enhanced_column_dumper.rb +77 -0
  10. data/lib/active_record/connection_adapters/oracle_enhanced_connection.rb +8 -24
  11. data/lib/active_record/connection_adapters/oracle_enhanced_context_index.rb +4 -13
  12. data/lib/active_record/connection_adapters/oracle_enhanced_database_tasks.rb +61 -0
  13. data/lib/active_record/connection_adapters/oracle_enhanced_dirty.rb +13 -12
  14. data/lib/active_record/connection_adapters/oracle_enhanced_jdbc_connection.rb +42 -19
  15. data/lib/active_record/connection_adapters/oracle_enhanced_oci_connection.rb +28 -74
  16. data/lib/active_record/connection_adapters/oracle_enhanced_procedures.rb +165 -231
  17. data/lib/active_record/connection_adapters/oracle_enhanced_schema_creation.rb +89 -0
  18. data/lib/active_record/connection_adapters/oracle_enhanced_schema_definitions.rb +16 -24
  19. data/lib/active_record/connection_adapters/oracle_enhanced_schema_dumper.rb +29 -38
  20. data/lib/active_record/connection_adapters/oracle_enhanced_schema_statements.rb +93 -42
  21. data/lib/active_record/connection_adapters/oracle_enhanced_schema_statements_ext.rb +5 -3
  22. data/lib/active_record/connection_adapters/oracle_enhanced_structure_dump.rb +7 -7
  23. data/lib/active_record/connection_adapters/oracle_enhanced_version.rb +1 -1
  24. data/lib/pmacs-activerecord-oracle_enhanced-adapter.rb +2 -2
  25. data/pmacs-activerecord-oracle_enhanced-adapter.gemspec +19 -17
  26. data/spec/active_record/connection_adapters/oracle_enhanced_adapter_spec.rb +35 -99
  27. data/spec/active_record/connection_adapters/oracle_enhanced_connection_spec.rb +17 -3
  28. data/spec/active_record/connection_adapters/oracle_enhanced_context_index_spec.rb +105 -98
  29. data/spec/active_record/connection_adapters/oracle_enhanced_data_types_spec.rb +74 -44
  30. data/spec/active_record/connection_adapters/oracle_enhanced_database_tasks_spec.rb +89 -0
  31. data/spec/active_record/connection_adapters/oracle_enhanced_dbms_output_spec.rb +3 -3
  32. data/spec/active_record/connection_adapters/oracle_enhanced_dirty_spec.rb +13 -2
  33. data/spec/active_record/connection_adapters/oracle_enhanced_procedures_spec.rb +11 -12
  34. data/spec/active_record/connection_adapters/oracle_enhanced_schema_dump_spec.rb +252 -60
  35. data/spec/active_record/connection_adapters/oracle_enhanced_schema_statements_spec.rb +170 -40
  36. data/spec/active_record/connection_adapters/oracle_enhanced_structure_dump_spec.rb +14 -8
  37. data/spec/spec_helper.rb +25 -54
  38. metadata +41 -72
  39. data/lib/active_record/connection_adapters/oracle_enhanced.rake +0 -105
  40. data/lib/active_record/connection_adapters/oracle_enhanced_activerecord_patches.rb +0 -41
  41. data/lib/active_record/connection_adapters/oracle_enhanced_base_ext.rb +0 -118
  42. data/lib/active_record/connection_adapters/oracle_enhanced_core_ext.rb +0 -25
  43. data/lib/active_record/connection_adapters/oracle_enhanced_tasks.rb +0 -17
  44. data/spec/active_record/connection_adapters/oracle_enhanced_core_ext_spec.rb +0 -19
@@ -103,9 +103,11 @@ module ActiveRecord
103
103
  references = options[:references] ? options[:references].first : nil
104
104
  references_sql = quote_column_name(options[:primary_key] || references || "id")
105
105
  end
106
-
107
- sql = "FOREIGN KEY (#{columns_sql}) REFERENCES #{quote_table_name(to_table)}(#{references_sql})"
108
-
106
+
107
+ table_name = ActiveRecord::Migrator.proper_table_name(to_table)
108
+
109
+ sql = "FOREIGN KEY (#{columns_sql}) REFERENCES #{quote_table_name(table_name)}(#{references_sql})"
110
+
109
111
  case options[:dependent]
110
112
  when :nullify
111
113
  sql << " ON DELETE SET NULL"
@@ -136,7 +136,7 @@ module ActiveRecord #:nodoc:
136
136
 
137
137
  def dump_schema_information #:nodoc:
138
138
  sm_table = ActiveRecord::Migrator.schema_migrations_table_name
139
- migrated = select_values("SELECT version FROM #{sm_table}")
139
+ migrated = select_values("SELECT version FROM #{sm_table} ORDER BY version")
140
140
  join_with_statement_token(migrated.map{|v| "INSERT INTO #{sm_table} (version) VALUES ('#{v}')" })
141
141
  end
142
142
 
@@ -149,23 +149,23 @@ module ActiveRecord #:nodoc:
149
149
  AND name NOT LIKE 'BIN$%'
150
150
  AND owner = SYS_CONTEXT('userenv', 'current_schema') ORDER BY type").each do |source|
151
151
  ddl = "CREATE OR REPLACE \n"
152
- lines = select_all(%Q{
152
+ select_all(%Q{
153
153
  SELECT text
154
154
  FROM all_source
155
155
  WHERE name = '#{source['name']}'
156
156
  AND type = '#{source['type']}'
157
157
  AND owner = SYS_CONTEXT('userenv', 'current_schema')
158
158
  ORDER BY line
159
- }).map do |row|
159
+ }).each do |row|
160
160
  ddl << row['text']
161
161
  end
162
- ddl << ";" unless ddl.strip[-1,1] == ";"
162
+ ddl << ";" unless ddl.strip[-1,1] == ';'
163
163
  structure << ddl
164
164
  end
165
165
 
166
166
  # export views
167
- select_all("SELECT view_name, text FROM user_views").each do |view|
168
- structure << "CREATE OR REPLACE VIEW #{view['view_name']} AS\n #{view['text']}"
167
+ select_all("SELECT view_name, text FROM user_views ORDER BY view_name ASC").each do |view|
168
+ structure << "CREATE OR REPLACE FORCE VIEW #{view['view_name']} AS\n #{view['text']}"
169
169
  end
170
170
 
171
171
  # export synonyms
@@ -240,7 +240,7 @@ module ActiveRecord #:nodoc:
240
240
 
241
241
  def execute_structure_dump(string)
242
242
  string.split(STATEMENT_TOKEN).each do |ddl|
243
- ddl.chop! if ddl.last == ";"
243
+ ddl.chop! if ddl[-1,1] == ';'
244
244
  execute(ddl) unless ddl.blank?
245
245
  end
246
246
  end
@@ -1 +1 @@
1
- ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter::VERSION = File.read(File.dirname(__FILE__)+'/../../../VERSION').chomp
1
+ ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter::VERSION = File.read(File.expand_path('../../../../VERSION', __FILE__)).chomp
@@ -5,7 +5,7 @@ if defined?(::Rails::Railtie)
5
5
  module ConnectionAdapters
6
6
  class OracleEnhancedRailtie < ::Rails::Railtie
7
7
  rake_tasks do
8
- load 'active_record/connection_adapters/oracle_enhanced.rake'
8
+ load 'active_record/connection_adapters/oracle_enhanced_database_tasks.rb'
9
9
  end
10
10
 
11
11
  ActiveSupport.on_load(:active_record) do
@@ -22,4 +22,4 @@ if defined?(::Rails::Railtie)
22
22
  end
23
23
  end
24
24
 
25
- end
25
+ end
@@ -4,14 +4,18 @@
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = "pmacs-activerecord-oracle_enhanced-adapter"
8
- s.version = "1.4.2.rc1"
7
+ s.name = %q{pmacs-activerecord-oracle_enhanced-adapter}
8
+ s.version = "1.5.1.1"
9
9
 
10
- s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Charles Treatman", "Raimonds Simanovskis"]
12
- s.date = "2013-02-22"
13
- s.description = "Oracle \"enhanced\" ActiveRecord adapter contains useful additional methods for working with new and legacy Oracle databases.\nThis adapter is superset of original ActiveRecord Oracle adapter.\n"
14
- s.email = "charles.treatman@gmail.com"
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = [%q{Charles Treatman}, %q{Raimonds Simanovskis}]
12
+ s.date = %q{2013-03-18}
13
+ s.version = "1.5.5.1"
14
+
15
+ s.description = %q{Oracle "enhanced" ActiveRecord adapter contains useful additional methods for working with new and legacy Oracle databases.
16
+ This adapter is superset of original ActiveRecord Oracle adapter.
17
+ }
18
+ s.email = %q{charles.treatman@gmail.com}
15
19
  s.extra_rdoc_files = [
16
20
  "README.md"
17
21
  ]
@@ -25,33 +29,31 @@ Gem::Specification.new do |s|
25
29
  "Rakefile",
26
30
  "VERSION",
27
31
  "lib/active_record/connection_adapters/emulation/oracle_adapter.rb",
28
- "lib/active_record/connection_adapters/oracle_enhanced.rake",
29
- "lib/active_record/connection_adapters/oracle_enhanced_activerecord_patches.rb",
30
32
  "lib/active_record/connection_adapters/oracle_enhanced_adapter.rb",
31
- "lib/active_record/connection_adapters/oracle_enhanced_base_ext.rb",
32
33
  "lib/active_record/connection_adapters/oracle_enhanced_column.rb",
34
+ "lib/active_record/connection_adapters/oracle_enhanced_column_dumper.rb",
33
35
  "lib/active_record/connection_adapters/oracle_enhanced_connection.rb",
34
36
  "lib/active_record/connection_adapters/oracle_enhanced_context_index.rb",
35
- "lib/active_record/connection_adapters/oracle_enhanced_core_ext.rb",
36
37
  "lib/active_record/connection_adapters/oracle_enhanced_cpk.rb",
38
+ "lib/active_record/connection_adapters/oracle_enhanced_database_tasks.rb",
37
39
  "lib/active_record/connection_adapters/oracle_enhanced_dirty.rb",
38
40
  "lib/active_record/connection_adapters/oracle_enhanced_jdbc_connection.rb",
39
41
  "lib/active_record/connection_adapters/oracle_enhanced_oci_connection.rb",
40
42
  "lib/active_record/connection_adapters/oracle_enhanced_procedures.rb",
43
+ "lib/active_record/connection_adapters/oracle_enhanced_schema_creation.rb",
41
44
  "lib/active_record/connection_adapters/oracle_enhanced_schema_definitions.rb",
42
45
  "lib/active_record/connection_adapters/oracle_enhanced_schema_dumper.rb",
43
46
  "lib/active_record/connection_adapters/oracle_enhanced_schema_statements.rb",
44
47
  "lib/active_record/connection_adapters/oracle_enhanced_schema_statements_ext.rb",
45
48
  "lib/active_record/connection_adapters/oracle_enhanced_structure_dump.rb",
46
- "lib/active_record/connection_adapters/oracle_enhanced_tasks.rb",
47
49
  "lib/active_record/connection_adapters/oracle_enhanced_version.rb",
48
50
  "lib/pmacs-activerecord-oracle_enhanced-adapter.rb",
49
51
  "pmacs-activerecord-oracle_enhanced-adapter.gemspec",
50
52
  "spec/active_record/connection_adapters/oracle_enhanced_adapter_spec.rb",
51
53
  "spec/active_record/connection_adapters/oracle_enhanced_connection_spec.rb",
52
54
  "spec/active_record/connection_adapters/oracle_enhanced_context_index_spec.rb",
53
- "spec/active_record/connection_adapters/oracle_enhanced_core_ext_spec.rb",
54
55
  "spec/active_record/connection_adapters/oracle_enhanced_cpk_spec.rb",
56
+ "spec/active_record/connection_adapters/oracle_enhanced_database_tasks_spec.rb",
55
57
  "spec/active_record/connection_adapters/oracle_enhanced_data_types_spec.rb",
56
58
  "spec/active_record/connection_adapters/oracle_enhanced_dbms_output_spec.rb",
57
59
  "spec/active_record/connection_adapters/oracle_enhanced_dirty_spec.rb",
@@ -70,8 +72,8 @@ Gem::Specification.new do |s|
70
72
  "spec/active_record/connection_adapters/oracle_enhanced_adapter_spec.rb",
71
73
  "spec/active_record/connection_adapters/oracle_enhanced_connection_spec.rb",
72
74
  "spec/active_record/connection_adapters/oracle_enhanced_context_index_spec.rb",
73
- "spec/active_record/connection_adapters/oracle_enhanced_core_ext_spec.rb",
74
75
  "spec/active_record/connection_adapters/oracle_enhanced_cpk_spec.rb",
76
+ "spec/active_record/connection_adapters/oracle_enhanced_database_tasks_spec.rb",
75
77
  "spec/active_record/connection_adapters/oracle_enhanced_data_types_spec.rb",
76
78
  "spec/active_record/connection_adapters/oracle_enhanced_dbms_output_spec.rb",
77
79
  "spec/active_record/connection_adapters/oracle_enhanced_dirty_spec.rb",
@@ -87,7 +89,7 @@ Gem::Specification.new do |s|
87
89
  s.specification_version = 3
88
90
 
89
91
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
90
- s.add_development_dependency(%q<jeweler>, ["~> 1.5.1"])
92
+ s.add_development_dependency(%q<jeweler>, ["~> 1.8"])
91
93
  s.add_development_dependency(%q<rspec>, ["~> 2.4"])
92
94
  s.add_development_dependency(%q<rdoc>, [">= 0"])
93
95
  s.add_development_dependency(%q<activerecord>, [">= 0"])
@@ -100,7 +102,7 @@ Gem::Specification.new do |s|
100
102
  s.add_development_dependency(%q<ruby-plsql>, [">= 0.4.4"])
101
103
  s.add_development_dependency(%q<ruby-oci8>, [">= 2.0.4"])
102
104
  else
103
- s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
105
+ s.add_dependency(%q<jeweler>, ["~> 1.8"])
104
106
  s.add_dependency(%q<rspec>, ["~> 2.4"])
105
107
  s.add_dependency(%q<rdoc>, [">= 0"])
106
108
  s.add_dependency(%q<activerecord>, [">= 0"])
@@ -114,7 +116,7 @@ Gem::Specification.new do |s|
114
116
  s.add_dependency(%q<ruby-oci8>, [">= 2.0.4"])
115
117
  end
116
118
  else
117
- s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
119
+ s.add_dependency(%q<jeweler>, ["~> 1.8"])
118
120
  s.add_dependency(%q<rspec>, ["~> 2.4"])
119
121
  s.add_dependency(%q<rdoc>, [">= 0"])
120
122
  s.add_dependency(%q<activerecord>, [">= 0"])
@@ -41,76 +41,6 @@ describe "OracleEnhancedAdapter" do
41
41
  ActiveRecord::Base.establish_connection(CONNECTION_PARAMS)
42
42
  end
43
43
 
44
- describe "database session store" do
45
- before(:all) do
46
- @conn.execute "DROP TABLE sessions" rescue nil
47
- @conn.execute "DROP SEQUENCE sessions_seq" rescue nil
48
- @conn = ActiveRecord::Base.connection
49
- @conn.execute <<-SQL
50
- CREATE TABLE sessions (
51
- id NUMBER(38,0) NOT NULL,
52
- session_id VARCHAR2(255) DEFAULT NULL,
53
- data CLOB DEFAULT NULL,
54
- created_at DATE DEFAULT NULL,
55
- updated_at DATE DEFAULT NULL,
56
- PRIMARY KEY (ID)
57
- )
58
- SQL
59
- @conn.execute <<-SQL
60
- CREATE SEQUENCE sessions_seq MINVALUE 1 MAXVALUE 999999999999999999999999999
61
- INCREMENT BY 1 START WITH 10040 CACHE 20 NOORDER NOCYCLE
62
- SQL
63
- if ENV['RAILS_GEM_VERSION'] >= '2.3'
64
- @session_class = ActiveRecord::SessionStore::Session
65
- else
66
- @session_class = CGI::Session::ActiveRecordStore::Session
67
- end
68
- end
69
-
70
- after(:all) do
71
- @conn.execute "DROP TABLE sessions"
72
- @conn.execute "DROP SEQUENCE sessions_seq"
73
- end
74
-
75
- it "should create sessions table" do
76
- ActiveRecord::Base.connection.tables.grep("sessions").should_not be_empty
77
- end
78
-
79
- it "should save session data" do
80
- @session = @session_class.new :session_id => "111111", :data => "something" #, :updated_at => Time.now
81
- @session.save!
82
- @session = @session_class.find_by_session_id("111111")
83
- @session.data.should == "something"
84
- end
85
-
86
- it "should change session data when partial updates enabled" do
87
- return pending("Not in this ActiveRecord version") unless @session_class.respond_to?(:partial_updates=)
88
- @session_class.partial_updates = true
89
- @session = @session_class.new :session_id => "222222", :data => "something" #, :updated_at => Time.now
90
- @session.save!
91
- @session = @session_class.find_by_session_id("222222")
92
- @session.data = "other thing"
93
- @session.save!
94
- # second save should call again blob writing callback
95
- @session.save!
96
- @session = @session_class.find_by_session_id("222222")
97
- @session.data.should == "other thing"
98
- end
99
-
100
- it "should have one enhanced_write_lobs callback" do
101
- return pending("Not in this ActiveRecord version") unless @session_class.respond_to?(:after_save_callback_chain)
102
- @session_class.after_save_callback_chain.select{|cb| cb.method == :enhanced_write_lobs}.should have(1).record
103
- end
104
-
105
- it "should not set sessions table session_id column type as integer if emulate_integers_by_column_name is true" do
106
- ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.emulate_integers_by_column_name = true
107
- columns = @conn.columns('sessions')
108
- column = columns.detect{|c| c.name == "session_id"}
109
- column.type.should == :string
110
- end
111
-
112
- end
113
-
114
44
  describe "ignore specified table columns" do
115
45
  before(:all) do
116
46
  @conn = ActiveRecord::Base.connection
@@ -186,13 +116,14 @@ describe "OracleEnhancedAdapter" do
186
116
  before(:all) do
187
117
  @conn = ActiveRecord::Base.connection
188
118
  @conn.execute "DROP TABLE test_employees" rescue nil
189
- @oracle11g = !! @conn.select_value("SELECT * FROM v$version WHERE banner LIKE 'Oracle%11g%'")
119
+ @oracle11g_or_higher = !! @conn.select_value(
120
+ "select * from product_component_version where product like 'Oracle%' and to_number(substr(version,1,2)) >= 11")
190
121
  @conn.execute <<-SQL
191
122
  CREATE TABLE test_employees (
192
123
  id NUMBER PRIMARY KEY,
193
124
  first_name VARCHAR2(20),
194
125
  last_name VARCHAR2(25),
195
- #{ @oracle11g ? "full_name AS (first_name || ' ' || last_name)," : "full_name VARCHAR2(46),"}
126
+ #{ @oracle11g_or_higher ? "full_name AS (first_name || ' ' || last_name)," : "full_name VARCHAR2(46),"}
196
127
  hire_date DATE
197
128
  )
198
129
  SQL
@@ -209,11 +140,7 @@ describe "OracleEnhancedAdapter" do
209
140
  end
210
141
  # Another class using the same table
211
142
  class ::TestEmployee2 < ActiveRecord::Base
212
- if self.respond_to?(:table_name=)
213
- self.table_name = "test_employees"
214
- else
215
- set_table_name "test_employees"
216
- end
143
+ self.table_name = "test_employees"
217
144
  end
218
145
  end
219
146
 
@@ -244,7 +171,7 @@ describe "OracleEnhancedAdapter" do
244
171
  end
245
172
 
246
173
  it 'should identify virtual columns as such' do
247
- pending "Not supported in this database version" unless @oracle11g
174
+ pending "Not supported in this database version" unless @oracle11g_or_higher
248
175
  te = TestEmployee.connection.columns('test_employees').detect(&:virtual?)
249
176
  te.name.should == 'full_name'
250
177
  end
@@ -336,11 +263,7 @@ describe "OracleEnhancedAdapter" do
336
263
  SQL
337
264
  Object.send(:remove_const, 'CompositePrimaryKeys') if defined?(CompositePrimaryKeys)
338
265
  class ::TestEmployee < ActiveRecord::Base
339
- if self.respond_to?(:primary_key=)
340
- self.primary_key = :employee_id
341
- else
342
- set_primary_key :employee_id
343
- end
266
+ self.primary_key = :employee_id
344
267
  end
345
268
  end
346
269
 
@@ -517,11 +440,7 @@ describe "OracleEnhancedAdapter" do
517
440
  it "should allow creation of a table with non alphanumeric characters" do
518
441
  create_warehouse_things_table
519
442
  class ::WarehouseThing < ActiveRecord::Base
520
- if self.respond_to?(:table_name=)
521
- self.table_name = "warehouse-things"
522
- else
523
- set_table_name "warehouse-things"
524
- end
443
+ self.table_name = "warehouse-things"
525
444
  end
526
445
 
527
446
  wh = WarehouseThing.create!(:name => "Foo", :foo => 2)
@@ -533,11 +452,7 @@ describe "OracleEnhancedAdapter" do
533
452
  it "should allow creation of a table with CamelCase name" do
534
453
  create_camel_case_table
535
454
  class ::CamelCase < ActiveRecord::Base
536
- if self.respond_to?(:table_name=)
537
- self.table_name = "CamelCase"
538
- else
539
- set_table_name "CamelCase"
540
- end
455
+ self.table_name = "CamelCase"
541
456
  end
542
457
 
543
458
  cc = CamelCase.create!(:name => "Foo", :foo => 2)
@@ -569,11 +484,7 @@ describe "OracleEnhancedAdapter" do
569
484
  @conn.execute "CREATE OR REPLACE SYNONYM test_posts_seq FOR test_posts_seq@#{@db_link}"
570
485
  class ::TestPost < ActiveRecord::Base
571
486
  end
572
- if TestPost.respond_to?(:table_name=)
573
- TestPost.table_name = "test_posts"
574
- else
575
- TestPost.set_table_name "test_posts"
576
- end
487
+ TestPost.table_name = "test_posts"
577
488
  end
578
489
 
579
490
  after(:all) do
@@ -682,7 +593,7 @@ describe "OracleEnhancedAdapter" do
682
593
  end
683
594
 
684
595
  it "should load included association with more than 1000 records" do
685
- posts = TestPost.includes(:test_comments).all
596
+ posts = TestPost.includes(:test_comments).to_a
686
597
  posts.size.should == @ids.size
687
598
  end
688
599
 
@@ -775,4 +686,29 @@ describe "OracleEnhancedAdapter" do
775
686
  explain.should include("INDEX UNIQUE SCAN")
776
687
  end
777
688
  end if ENV['RAILS_GEM_VERSION'] >= '3.2'
689
+
690
+ describe ".is_integer_column?" do
691
+ before(:all) do
692
+ @adapter = ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter
693
+ end
694
+
695
+ it "should return TrueClass or FalseClass" do
696
+ @adapter.is_integer_column?("adapter_id").should be_a TrueClass
697
+ @adapter.is_integer_column?("").should be_a FalseClass
698
+ end
699
+
700
+ it "should return true if name is 'id'" do
701
+ @adapter.is_integer_column?("id").should be_true
702
+ end
703
+
704
+ it "should return true if name ends with '_id'" do
705
+ @adapter.is_integer_column?("_id").should be_true
706
+ @adapter.is_integer_column?("foo_id").should be_true
707
+ end
708
+
709
+ it "should return false if name is 'something_else'" do
710
+ @adapter.is_integer_column?("something_else").should be_false
711
+ end
712
+ end
713
+
778
714
  end
@@ -92,7 +92,8 @@ describe "OracleEnhancedConnection" do
92
92
 
93
93
  it "should create new connection using :url" do
94
94
  params = CONNECTION_PARAMS.dup
95
- params[:url] = "jdbc:oracle:thin:@#{DATABASE_HOST && "#{DATABASE_HOST}:"}#{DATABASE_PORT && "#{DATABASE_PORT}:"}#{DATABASE_NAME}"
95
+ params[:url] = "jdbc:oracle:thin:@#{DATABASE_HOST && "//#{DATABASE_HOST}#{DATABASE_PORT && ":#{DATABASE_PORT}"}/"}#{DATABASE_NAME}"
96
+
96
97
  params[:host] = nil
97
98
  params[:database] = nil
98
99
  @conn = ActiveRecord::ConnectionAdapters::OracleEnhancedConnection.create(params)
@@ -157,7 +158,7 @@ describe "OracleEnhancedConnection" do
157
158
 
158
159
  it "should fall back to directly instantiating OracleDriver" do
159
160
  params = CONNECTION_PARAMS.dup
160
- params[:url] = "jdbc:oracle:thin:@#{DATABASE_HOST && "#{DATABASE_HOST}:"}#{DATABASE_PORT && "#{DATABASE_PORT}:"}#{DATABASE_NAME}"
161
+ params[:url] = "jdbc:oracle:thin:@#{DATABASE_HOST && "//#{DATABASE_HOST}#{DATABASE_PORT && ":#{DATABASE_PORT}"}/"}#{DATABASE_NAME}"
161
162
  params[:host] = nil
162
163
  params[:database] = nil
163
164
  java.sql.DriverManager.stub!(:getConnection).and_raise('no suitable driver found')
@@ -226,7 +227,9 @@ describe "OracleEnhancedConnection" do
226
227
 
227
228
  it "should execute prepared statement with decimal bind parameter " do
228
229
  cursor = @conn.prepare("INSERT INTO test_employees VALUES(:1)")
229
- cursor.bind_param(1, "1.5", :decimal)
230
+ column = ActiveRecord::ConnectionAdapters::OracleEnhancedColumn.new('age', nil, 'NUMBER(10,2)')
231
+ column.type.should == :decimal
232
+ cursor.bind_param(1, "1.5", column)
230
233
  cursor.exec
231
234
  cursor.close
232
235
  cursor = @conn.prepare("SELECT age FROM test_employees")
@@ -327,6 +330,17 @@ describe "OracleEnhancedConnection" do
327
330
  @conn.describe("all_tables").should == ["SYS", "ALL_TABLES"]
328
331
  end
329
332
 
333
+ if defined?(OCI8)
334
+ context "OCI8 adapter" do
335
+
336
+ it "should not fallback to SELECT-based logic when querying non-existant table information" do
337
+ @conn.should_not_receive(:select_one)
338
+ @conn.describe("non_existant") rescue ActiveRecord::ConnectionAdapters::OracleEnhancedConnectionException
339
+ end
340
+
341
+ end
342
+ end
343
+
330
344
  end
331
345
 
332
346
  end
@@ -7,19 +7,19 @@ describe "OracleEnhancedAdapter context index" do
7
7
 
8
8
  def create_table_posts
9
9
  schema_define do
10
- create_table :posts, :force => true do |t|
10
+ create_table :posts, force: true do |t|
11
11
  t.string :title
12
12
  t.text :body
13
13
  t.integer :comments_count
14
14
  t.timestamps
15
- t.string :all_text, :limit => 2 # will be used for multi-column index
15
+ t.string :all_text, limit: 2 # will be used for multi-column index
16
16
  end
17
17
  end
18
18
  end
19
19
 
20
20
  def create_table_comments
21
21
  schema_define do
22
- create_table :comments, :force => true do |t|
22
+ create_table :comments, force: true do |t|
23
23
  t.integer :post_id
24
24
  t.string :author
25
25
  t.text :body
@@ -68,11 +68,11 @@ describe "OracleEnhancedAdapter context index" do
68
68
  class ::Post < ActiveRecord::Base
69
69
  has_context_index
70
70
  end
71
- @post0 = Post.create(:title => "dummy title", :body => "dummy body")
72
- @post1 = Post.create(:title => @title_words.join(' '), :body => @body_words.join(' '))
73
- @post2 = Post.create(:title => (@title_words*2).join(' '), :body => (@body_words*2).join(' '))
74
- @post_with_null_body = Post.create(:title => "withnull", :body => nil)
75
- @post_with_null_title = Post.create(:title => nil, :body => "withnull")
71
+ @post0 = Post.create(title: "dummy title", body: "dummy body")
72
+ @post1 = Post.create(title: @title_words.join(' '), body: @body_words.join(' '))
73
+ @post2 = Post.create(title: (@title_words*2).join(' '), body: (@body_words*2).join(' '))
74
+ @post_with_null_body = Post.create(title: "withnull", body: nil)
75
+ @post_with_null_title = Post.create(title: nil, body: "withnull")
76
76
  end
77
77
 
78
78
  after(:all) do
@@ -88,7 +88,7 @@ describe "OracleEnhancedAdapter context index" do
88
88
  it "should create single VARCHAR2 column index" do
89
89
  @conn.add_context_index :posts, :title
90
90
  @title_words.each do |word|
91
- Post.contains(:title, word).all.should == [@post2, @post1]
91
+ Post.contains(:title, word).to_a.should == [@post2, @post1]
92
92
  end
93
93
  @conn.remove_context_index :posts, :title
94
94
  end
@@ -96,7 +96,7 @@ describe "OracleEnhancedAdapter context index" do
96
96
  it "should create single CLOB column index" do
97
97
  @conn.add_context_index :posts, :body
98
98
  @body_words.each do |word|
99
- Post.contains(:body, word).all.should == [@post2, @post1]
99
+ Post.contains(:body, word).to_a.should == [@post2, @post1]
100
100
  end
101
101
  @conn.remove_context_index :posts, :body
102
102
  end
@@ -110,62 +110,62 @@ describe "OracleEnhancedAdapter context index" do
110
110
  it "should create multiple column index" do
111
111
  @conn.add_context_index :posts, [:title, :body]
112
112
  (@title_words+@body_words).each do |word|
113
- Post.contains(:title, word).all.should == [@post2, @post1]
113
+ Post.contains(:title, word).to_a.should == [@post2, @post1]
114
114
  end
115
115
  @conn.remove_context_index :posts, [:title, :body]
116
116
  end
117
117
 
118
118
  it "should index records with null values" do
119
119
  @conn.add_context_index :posts, [:title, :body]
120
- Post.contains(:title, "withnull").all.should == [@post_with_null_body, @post_with_null_title]
120
+ Post.contains(:title, "withnull").to_a.should == [@post_with_null_body, @post_with_null_title]
121
121
  @conn.remove_context_index :posts, [:title, :body]
122
122
  end
123
123
 
124
124
  it "should create multiple column index with specified main index column" do
125
125
  @conn.add_context_index :posts, [:title, :body],
126
- :index_column => :all_text, :sync => 'ON COMMIT'
127
- @post = Post.create(:title => "abc", :body => "def")
128
- Post.contains(:all_text, "abc").all.should == [@post]
129
- Post.contains(:all_text, "def").all.should == [@post]
130
- @post.update_attributes!(:title => "ghi")
126
+ index_column: :all_text, sync: 'ON COMMIT'
127
+ @post = Post.create(title: "abc", body: "def")
128
+ Post.contains(:all_text, "abc").to_a.should == [@post]
129
+ Post.contains(:all_text, "def").to_a.should == [@post]
130
+ @post.update_attributes!(title: "ghi")
131
131
  # index will not be updated as all_text column is not changed
132
- Post.contains(:all_text, "ghi").all.should be_empty
133
- @post.update_attributes!(:all_text => "1")
132
+ Post.contains(:all_text, "ghi").to_a.should be_empty
133
+ @post.update_attributes!(all_text: "1")
134
134
  # index will be updated when all_text column is changed
135
- Post.contains(:all_text, "ghi").all.should == [@post]
136
- @conn.remove_context_index :posts, :index_column => :all_text
135
+ Post.contains(:all_text, "ghi").to_a.should == [@post]
136
+ @conn.remove_context_index :posts, index_column: :all_text
137
137
  end
138
138
 
139
139
  it "should create multiple column index with trigger updated main index column" do
140
140
  @conn.add_context_index :posts, [:title, :body],
141
- :index_column => :all_text, :index_column_trigger_on => [:created_at, :updated_at],
142
- :sync => 'ON COMMIT'
143
- @post = Post.create(:title => "abc", :body => "def")
144
- Post.contains(:all_text, "abc").all.should == [@post]
145
- Post.contains(:all_text, "def").all.should == [@post]
146
- @post.update_attributes!(:title => "ghi")
141
+ index_column: :all_text, index_column_trigger_on: [:created_at, :updated_at],
142
+ sync: 'ON COMMIT'
143
+ @post = Post.create(title: "abc", body: "def")
144
+ Post.contains(:all_text, "abc").to_a.should == [@post]
145
+ Post.contains(:all_text, "def").to_a.should == [@post]
146
+ @post.update_attributes!(title: "ghi")
147
147
  # index should be updated as created_at column is changed
148
- Post.contains(:all_text, "ghi").all.should == [@post]
149
- @conn.remove_context_index :posts, :index_column => :all_text
148
+ Post.contains(:all_text, "ghi").to_a.should == [@post]
149
+ @conn.remove_context_index :posts, index_column: :all_text
150
150
  end
151
151
 
152
152
  it "should use base letter conversion with BASIC_LEXER" do
153
- @post = Post.create!(:title => "āčē", :body => "dummy")
153
+ @post = Post.create!(title: "āčē", body: "dummy")
154
154
  @conn.add_context_index :posts, :title,
155
- :lexer => { :type => "BASIC_LEXER", :base_letter_type => 'GENERIC', :base_letter => true }
156
- Post.contains(:title, "āčē").all.should == [@post]
157
- Post.contains(:title, "ace").all.should == [@post]
158
- Post.contains(:title, "ACE").all.should == [@post]
155
+ lexer: { type: "BASIC_LEXER", base_letter_type: 'GENERIC', base_letter: true }
156
+ Post.contains(:title, "āčē").to_a.should == [@post]
157
+ Post.contains(:title, "ace").to_a.should == [@post]
158
+ Post.contains(:title, "ACE").to_a.should == [@post]
159
159
  @conn.remove_context_index :posts, :title
160
160
  end
161
161
 
162
162
  it "should create transactional index and sync index within transaction on inserts and updates" do
163
- @conn.add_context_index :posts, :title, :transactional => true
163
+ @conn.add_context_index :posts, :title, transactional: true
164
164
  Post.transaction do
165
- @post = Post.create(:title => "abc")
166
- Post.contains(:title, "abc").all.should == [@post]
167
- @post.update_attributes!(:title => "ghi")
168
- Post.contains(:title, "ghi").all.should == [@post]
165
+ @post = Post.create(title: "abc")
166
+ Post.contains(:title, "abc").to_a.should == [@post]
167
+ @post.update_attributes!(title: "ghi")
168
+ Post.contains(:title, "ghi").to_a.should == [@post]
169
169
  end
170
170
  @conn.remove_context_index :posts, :title
171
171
  end
@@ -174,13 +174,15 @@ describe "OracleEnhancedAdapter context index" do
174
174
  describe "on multiple tables" do
175
175
  before(:all) do
176
176
  @conn = ActiveRecord::Base.connection
177
+ @oracle12c = !! @conn.select_value(
178
+ "select * from product_component_version where product like 'Oracle%' and to_number(substr(version,1,2)) = 12")
177
179
  create_tables
178
180
  class ::Post < ActiveRecord::Base
179
- has_many :comments, :dependent => :destroy
181
+ has_many :comments, dependent: :destroy
180
182
  has_context_index
181
183
  end
182
184
  class ::Comment < ActiveRecord::Base
183
- belongs_to :post, :counter_cache => true
185
+ belongs_to :post, counter_cache: true
184
186
  end
185
187
  end
186
188
 
@@ -192,28 +194,31 @@ describe "OracleEnhancedAdapter context index" do
192
194
  end
193
195
 
194
196
  after(:each) do
197
+ @conn.remove_context_index :posts, name: 'post_and_comments_index' rescue nil
198
+ @conn.remove_context_index :posts, index_column: :all_text rescue nil
195
199
  Post.destroy_all
196
200
  end
197
201
 
198
202
  it "should create multiple table index with specified main index column" do
203
+ pending "It always fails when Oracle 12c 12.1.0 used." if @oracle12c
199
204
  @conn.add_context_index :posts,
200
205
  [:title, :body,
201
206
  # specify aliases always with AS keyword
202
207
  "SELECT comments.author AS comment_author, comments.body AS comment_body FROM comments WHERE comments.post_id = :id"
203
208
  ],
204
- :name => 'post_and_comments_index',
205
- :index_column => :all_text, :index_column_trigger_on => [:updated_at, :comments_count],
206
- :sync => 'ON COMMIT'
207
- @post = Post.create!(:title => "aaa", :body => "bbb")
208
- @post.comments.create!(:author => "ccc", :body => "ddd")
209
- @post.comments.create!(:author => "eee", :body => "fff")
209
+ name: 'post_and_comments_index',
210
+ index_column: :all_text, index_column_trigger_on: [:updated_at, :comments_count],
211
+ sync: 'ON COMMIT'
212
+ @post = Post.create!(title: "aaa", body: "bbb")
213
+ @post.comments.create!(author: "ccc", body: "ddd")
214
+ @post.comments.create!(author: "eee", body: "fff")
210
215
  ["aaa", "bbb", "ccc", "ddd", "eee", "fff"].each do |word|
211
- Post.contains(:all_text, word).all.should == [@post]
216
+ Post.contains(:all_text, word).to_a.should == [@post]
212
217
  end
213
- @conn.remove_context_index :posts, :name => 'post_and_comments_index'
214
218
  end
215
219
 
216
220
  it "should create multiple table index with specified main index column (when subquery has newlines)" do
221
+ pending "It always fails when Oracle 12c 12.1.0 used." if @oracle12c
217
222
  @conn.add_context_index :posts,
218
223
  [:title, :body,
219
224
  # specify aliases always with AS keyword
@@ -223,36 +228,34 @@ describe "OracleEnhancedAdapter context index" do
223
228
  FROM comments
224
229
  WHERE comments.post_id = :id }
225
230
  ],
226
- :name => 'post_and_comments_index',
227
- :index_column => :all_text, :index_column_trigger_on => [:updated_at, :comments_count],
228
- :sync => 'ON COMMIT'
229
- @post = Post.create!(:title => "aaa", :body => "bbb")
230
- @post.comments.create!(:author => "ccc", :body => "ddd")
231
- @post.comments.create!(:author => "eee", :body => "fff")
231
+ name: 'post_and_comments_index',
232
+ index_column: :all_text, index_column_trigger_on: [:updated_at, :comments_count],
233
+ sync: 'ON COMMIT'
234
+ @post = Post.create!(title: "aaa", body: "bbb")
235
+ @post.comments.create!(author: "ccc", body: "ddd")
236
+ @post.comments.create!(author: "eee", body: "fff")
232
237
  ["aaa", "bbb", "ccc", "ddd", "eee", "fff"].each do |word|
233
- Post.contains(:all_text, word).all.should == [@post]
238
+ Post.contains(:all_text, word).to_a.should == [@post]
234
239
  end
235
- @conn.remove_context_index :posts, :name => 'post_and_comments_index'
236
240
  end
237
241
 
238
242
  it "should find by search term within specified field" do
239
- @post = Post.create!(:title => "aaa", :body => "bbb")
240
- @post.comments.create!(:author => "ccc", :body => "ddd")
243
+ @post = Post.create!(title: "aaa", body: "bbb")
244
+ @post.comments.create!(author: "ccc", body: "ddd")
241
245
  @conn.add_context_index :posts,
242
246
  [:title, :body,
243
247
  # specify aliases always with AS keyword
244
248
  "SELECT comments.author AS comment_author, comments.body AS comment_body FROM comments WHERE comments.post_id = :id"
245
249
  ],
246
- :index_column => :all_text
247
- Post.contains(:all_text, "aaa within title").all.should == [@post]
248
- Post.contains(:all_text, "aaa within body").all.should be_empty
249
- Post.contains(:all_text, "bbb within body").all.should == [@post]
250
- Post.contains(:all_text, "bbb within title").all.should be_empty
251
- Post.contains(:all_text, "ccc within comment_author").all.should == [@post]
252
- Post.contains(:all_text, "ccc within comment_body").all.should be_empty
253
- Post.contains(:all_text, "ddd within comment_body").all.should == [@post]
254
- Post.contains(:all_text, "ddd within comment_author").all.should be_empty
255
- @conn.remove_context_index :posts, :index_column => :all_text
250
+ index_column: :all_text
251
+ Post.contains(:all_text, "aaa within title").to_a.should == [@post]
252
+ Post.contains(:all_text, "aaa within body").to_a.should be_empty
253
+ Post.contains(:all_text, "bbb within body").to_a.should == [@post]
254
+ Post.contains(:all_text, "bbb within title").to_a.should be_empty
255
+ Post.contains(:all_text, "ccc within comment_author").to_a.should == [@post]
256
+ Post.contains(:all_text, "ccc within comment_body").to_a.should be_empty
257
+ Post.contains(:all_text, "ddd within comment_body").to_a.should == [@post]
258
+ Post.contains(:all_text, "ddd within comment_author").to_a.should be_empty
256
259
  end
257
260
 
258
261
  end
@@ -264,7 +267,7 @@ describe "OracleEnhancedAdapter context index" do
264
267
  class ::Post < ActiveRecord::Base
265
268
  has_context_index
266
269
  end
267
- @post = Post.create(:title => 'aaa', :body => 'bbb')
270
+ @post = Post.create(title: 'aaa', body: 'bbb')
268
271
  @tablespace = @conn.default_tablespace
269
272
  set_logger
270
273
  @conn = ActiveRecord::Base.connection
@@ -288,17 +291,17 @@ describe "OracleEnhancedAdapter context index" do
288
291
  end
289
292
 
290
293
  it "should create index on single column" do
291
- @conn.add_context_index :posts, :title, :tablespace => @tablespace
294
+ @conn.add_context_index :posts, :title, tablespace: @tablespace
292
295
  verify_logged_statements
293
- Post.contains(:title, 'aaa').all.should == [@post]
296
+ Post.contains(:title, 'aaa').to_a.should == [@post]
294
297
  @conn.remove_context_index :posts, :title
295
298
  end
296
299
 
297
300
  it "should create index on multiple columns" do
298
- @conn.add_context_index :posts, [:title, :body], :name => 'index_posts_text', :tablespace => @conn.default_tablespace
301
+ @conn.add_context_index :posts, [:title, :body], name: 'index_posts_text', tablespace: @conn.default_tablespace
299
302
  verify_logged_statements
300
- Post.contains(:title, 'aaa AND bbb').all.should == [@post]
301
- @conn.remove_context_index :posts, :name => 'index_posts_text'
303
+ Post.contains(:title, 'aaa AND bbb').to_a.should == [@post]
304
+ @conn.remove_context_index :posts, name: 'index_posts_text'
302
305
  end
303
306
 
304
307
  end
@@ -325,7 +328,7 @@ describe "OracleEnhancedAdapter context index" do
325
328
 
326
329
  it "should dump definition of single column index" do
327
330
  @conn.add_context_index :posts, :title
328
- standard_dump.should =~ /add_context_index "posts", \["title"\], :name => \"index_posts_on_title\"$/
331
+ standard_dump.should =~ /add_context_index "posts", \["title"\], name: \"index_posts_on_title\"$/
329
332
  @conn.remove_context_index :posts, :title
330
333
  end
331
334
 
@@ -337,47 +340,50 @@ describe "OracleEnhancedAdapter context index" do
337
340
 
338
341
  it "should dump definition of multiple table index with options" do
339
342
  options = {
340
- :name => 'post_and_comments_index',
341
- :index_column => :all_text, :index_column_trigger_on => :updated_at,
342
- :transactional => true,
343
- :sync => 'ON COMMIT'
343
+ name: 'post_and_comments_index',
344
+ index_column: :all_text, index_column_trigger_on: :updated_at,
345
+ transactional: true,
346
+ sync: 'ON COMMIT'
344
347
  }
345
348
  sub_query = "SELECT comments.author AS comment_author, comments.body AS comment_body FROM comments WHERE comments.post_id = :id"
346
349
  @conn.add_context_index :posts, [:title, :body, sub_query], options
347
350
  standard_dump.should =~ /add_context_index "posts", \[:title, :body, "#{sub_query}"\], #{options.inspect[1..-2]}$/
348
- @conn.remove_context_index :posts, :name => 'post_and_comments_index'
351
+ @conn.remove_context_index :posts, name: 'post_and_comments_index'
349
352
  end
350
353
 
351
354
  it "should dump definition of multiple table index with options (when definition is larger than 4000 bytes)" do
352
355
  options = {
353
- :name => 'post_and_comments_index',
354
- :index_column => :all_text, :index_column_trigger_on => :updated_at,
355
- :transactional => true,
356
- :sync => 'ON COMMIT'
356
+ name: 'post_and_comments_index',
357
+ index_column: :all_text, index_column_trigger_on: :updated_at,
358
+ transactional: true,
359
+ sync: 'ON COMMIT'
357
360
  }
358
361
  sub_query = "SELECT comments.author AS comment_author, comments.body AS comment_body FROM comments WHERE comments.post_id = :id#{' AND 1=1' * 500}"
359
362
  @conn.add_context_index :posts, [:title, :body, sub_query], options
360
363
  standard_dump.should =~ /add_context_index "posts", \[:title, :body, "#{sub_query}"\], #{options.inspect[1..-2]}$/
361
- @conn.remove_context_index :posts, :name => 'post_and_comments_index'
364
+ @conn.remove_context_index :posts, name: 'post_and_comments_index'
362
365
  end
363
366
 
364
367
  it "should dump definition of multiple table index with options (when subquery has newlines)" do
365
368
  options = {
366
- :name => 'post_and_comments_index',
367
- :index_column => :all_text, :index_column_trigger_on => :updated_at,
368
- :transactional => true,
369
- :sync => 'ON COMMIT'
369
+ name: 'post_and_comments_index',
370
+ index_column: :all_text, index_column_trigger_on: :updated_at,
371
+ transactional: true,
372
+ sync: 'ON COMMIT'
370
373
  }
371
374
  sub_query = "SELECT comments.author AS comment_author, comments.body AS comment_body\nFROM comments\nWHERE comments.post_id = :id"
372
375
  @conn.add_context_index :posts, [:title, :body, sub_query], options
373
376
  standard_dump.should =~ /add_context_index "posts", \[:title, :body, "#{sub_query.gsub(/\n/, ' ')}"\], #{options.inspect[1..-2]}$/
374
- @conn.remove_context_index :posts, :name => 'post_and_comments_index'
377
+ @conn.remove_context_index :posts, name: 'post_and_comments_index'
375
378
  end
376
379
 
377
380
  end
378
381
 
379
382
  describe "with table prefix and suffix" do
380
383
  before(:all) do
384
+ @conn = ActiveRecord::Base.connection
385
+ @oracle12c = !! @conn.select_value(
386
+ "select * from product_component_version where product like 'Oracle%' and to_number(substr(version,1,2)) = 12")
381
387
  ActiveRecord::Base.table_name_prefix = 'xxx_'
382
388
  ActiveRecord::Base.table_name_suffix = '_xxx'
383
389
  create_tables
@@ -391,7 +397,7 @@ describe "OracleEnhancedAdapter context index" do
391
397
 
392
398
  it "should dump definition of single column index" do
393
399
  schema_define { add_context_index :posts, :title }
394
- standard_dump.should =~ /add_context_index "posts", \["title"\], :name => "i_xxx_posts_xxx_title"$/
400
+ standard_dump.should =~ /add_context_index "posts", \["title"\], name: "i_xxx_posts_xxx_title"$/
395
401
  schema_define { remove_context_index :posts, :title }
396
402
  end
397
403
 
@@ -402,12 +408,13 @@ describe "OracleEnhancedAdapter context index" do
402
408
  end
403
409
 
404
410
  it "should dump definition of multiple table index with options" do
411
+ pending "It always fails when Oracle 12c 12.1.0 used." if @oracle12c
405
412
  options = {
406
- :name => 'xxx_post_and_comments_i',
407
- :index_column => :all_text, :index_column_trigger_on => :updated_at,
408
- :lexer => { :type => "BASIC_LEXER", :base_letter_type => 'GENERIC', :base_letter => true },
409
- :wordlist => { :type => "BASIC_WORDLIST", :prefix_index => true },
410
- :sync => 'ON COMMIT'
413
+ name: 'xxx_post_and_comments_i',
414
+ index_column: :all_text, index_column_trigger_on: :updated_at,
415
+ lexer: { type: "BASIC_LEXER", base_letter_type: 'GENERIC', base_letter: true },
416
+ wordlist: { type: "BASIC_WORDLIST", prefix_index: true },
417
+ sync: 'ON COMMIT'
411
418
  }
412
419
  schema_define do
413
420
  add_context_index :posts,
@@ -417,7 +424,7 @@ describe "OracleEnhancedAdapter context index" do
417
424
  end
418
425
  standard_dump.should =~ /add_context_index "posts", \[:title, :body, "SELECT comments.author AS comment_author, comments.body AS comment_body FROM comments WHERE comments.post_id = :id"\], #{
419
426
  options.inspect[1..-2].gsub(/[{}]/){|s| '\\'<<s }}$/
420
- schema_define { remove_context_index :posts, :name => 'xxx_post_and_comments_i' }
427
+ schema_define { remove_context_index :posts, name: 'xxx_post_and_comments_i' }
421
428
  end
422
429
 
423
430
  end