ibm_db 2.5.6-x86-mswin32-60 → 2.5.7-x86-mswin32-60

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 (38) hide show
  1. data/CHANGES +6 -0
  2. data/README +1 -1
  3. data/ext/Makefile.nt32 +3 -3
  4. data/ext/Makefile.nt32.191 +212 -0
  5. data/ext/ibm_db.c +30 -5
  6. data/lib/active_record/connection_adapters/ibm_db_adapter.rb +300 -108
  7. data/lib/active_record/connection_adapters/ibm_db_pstmt.rb +1 -1
  8. data/lib/mswin32/rb18x/ibm_db.so +0 -0
  9. data/test/cases/adapter_test.rb +25 -22
  10. data/test/cases/associations/belongs_to_associations_test.rb +245 -43
  11. data/test/cases/associations/cascaded_eager_loading_test.rb +28 -26
  12. data/test/cases/associations/has_and_belongs_to_many_associations_test.rb +60 -156
  13. data/test/cases/associations/join_model_test.rb +96 -146
  14. data/test/cases/attribute_methods_test.rb +98 -33
  15. data/test/cases/base_test.rb +525 -103
  16. data/test/cases/calculations_test.rb +92 -8
  17. data/test/cases/migration_test.rb +533 -207
  18. data/test/cases/persistence_test.rb +636 -0
  19. data/test/cases/query_cache_test.rb +242 -0
  20. data/test/cases/relations_test.rb +1019 -0
  21. data/test/cases/schema_dumper_test.rb +37 -17
  22. data/test/cases/transaction_callbacks_test.rb +300 -0
  23. data/test/cases/validations/uniqueness_validation_test.rb +38 -22
  24. data/test/cases/xml_serialization_test.rb +276 -0
  25. data/test/config.yml +154 -0
  26. data/test/connections/native_ibm_db/connection.rb +2 -0
  27. data/test/models/warehouse_thing.rb +4 -4
  28. data/test/schema/i5/ibm_db_specific_schema.rb +3 -1
  29. data/test/schema/ids/ibm_db_specific_schema.rb +3 -1
  30. data/test/schema/luw/ibm_db_specific_schema.rb +2 -0
  31. data/test/schema/schema.rb +174 -89
  32. data/test/schema/zOS/ibm_db_specific_schema.rb +3 -1
  33. metadata +9 -7
  34. data/lib/mswin32/rb19x/ibm_db.so +0 -0
  35. data/test/cases/associations/eager_test.rb +0 -862
  36. data/test/cases/associations/has_many_through_associations_test.rb +0 -461
  37. data/test/cases/finder_test.rb +0 -1088
  38. data/test/cases/fixtures_test.rb +0 -684
@@ -15,18 +15,18 @@ class CascadedEagerLoadingTest < ActiveRecord::TestCase
15
15
 
16
16
  def test_eager_association_loading_with_cascaded_two_levels
17
17
  authors = Author.find(:all, :include=>{:posts=>:comments}, :order=>"authors.id")
18
- assert_equal 2, authors.size
18
+ assert_equal 3, authors.size
19
19
  assert_equal 5, authors[0].posts.size
20
- assert_equal 1, authors[1].posts.size
21
- assert_equal 9, authors[0].posts.collect{|post| post.comments.size }.inject(0){|sum,i| sum+i}
20
+ assert_equal 3, authors[1].posts.size
21
+ assert_equal 10, authors[0].posts.collect{|post| post.comments.size }.inject(0){|sum,i| sum+i}
22
22
  end
23
23
 
24
24
  def test_eager_association_loading_with_cascaded_two_levels_and_one_level
25
25
  authors = Author.find(:all, :include=>[{:posts=>:comments}, :categorizations], :order=>"authors.id")
26
- assert_equal 2, authors.size
26
+ assert_equal 3, authors.size
27
27
  assert_equal 5, authors[0].posts.size
28
- assert_equal 1, authors[1].posts.size
29
- assert_equal 9, authors[0].posts.collect{|post| post.comments.size }.inject(0){|sum,i| sum+i}
28
+ assert_equal 3, authors[1].posts.size
29
+ assert_equal 10, authors[0].posts.collect{|post| post.comments.size }.inject(0){|sum,i| sum+i}
30
30
  assert_equal 1, authors[0].categorizations.size
31
31
  assert_equal 2, authors[1].categorizations.size
32
32
  end
@@ -37,7 +37,7 @@ class CascadedEagerLoadingTest < ActiveRecord::TestCase
37
37
  end
38
38
  authors = Author.joins(:posts).eager_load(:comments).where(:posts => {:taggings_count => 1}).all
39
39
  assert_equal 1, assert_no_queries { authors.size }
40
- assert_equal 9, assert_no_queries { authors[0].comments.size }
40
+ assert_equal 10, assert_no_queries { authors[0].comments.size }
41
41
  end
42
42
 
43
43
  def test_eager_association_loading_grafts_stashed_associations_to_correct_parent
@@ -51,24 +51,26 @@ class CascadedEagerLoadingTest < ActiveRecord::TestCase
51
51
  categories = Category.joins(:categorizations).includes([{:posts=>:comments}, :authors])
52
52
 
53
53
  assert_nothing_raised do
54
- assert_equal 2, categories.count
55
- assert_equal 2, categories.all.uniq.size # Must uniq since instantiating with inner joins will get dupes
54
+ assert_equal 4, categories.count
55
+ assert_equal 4, categories.all.count
56
+ assert_equal 3, categories.count(:distinct => true)
57
+ assert_equal 3, categories.all.uniq.size # Must uniq since instantiating with inner joins will get dupes
56
58
  end
57
59
  end
58
60
 
59
61
  def test_cascaded_eager_association_loading_with_duplicated_includes
60
62
  categories = Category.includes(:categorizations).includes(:categorizations => :author).where("categorizations.id is not null")
61
63
  assert_nothing_raised do
62
- assert_equal 2, categories.count
63
- assert_equal 2, categories.all.size
64
+ assert_equal 3, categories.count
65
+ assert_equal 3, categories.all.size
64
66
  end
65
67
  end
66
68
 
67
69
  def test_cascaded_eager_association_loading_with_twice_includes_edge_cases
68
70
  categories = Category.includes(:categorizations => :author).includes(:categorizations => :post).where("posts.id is not null")
69
71
  assert_nothing_raised do
70
- assert_equal 2, categories.count
71
- assert_equal 2, categories.all.size
72
+ assert_equal 3, categories.count
73
+ assert_equal 3, categories.all.size
72
74
  end
73
75
  end
74
76
 
@@ -81,15 +83,15 @@ class CascadedEagerLoadingTest < ActiveRecord::TestCase
81
83
 
82
84
  def test_eager_association_loading_with_cascaded_two_levels_with_two_has_many_associations
83
85
  authors = Author.find(:all, :include=>{:posts=>[:comments, :categorizations]}, :order=>"authors.id")
84
- assert_equal 2, authors.size
86
+ assert_equal 3, authors.size
85
87
  assert_equal 5, authors[0].posts.size
86
- assert_equal 1, authors[1].posts.size
87
- assert_equal 9, authors[0].posts.collect{|post| post.comments.size }.inject(0){|sum,i| sum+i}
88
+ assert_equal 3, authors[1].posts.size
89
+ assert_equal 10, authors[0].posts.collect{|post| post.comments.size }.inject(0){|sum,i| sum+i}
88
90
  end
89
91
 
90
92
  def test_eager_association_loading_with_cascaded_two_levels_and_self_table_reference
91
93
  authors = Author.find(:all, :include=>{:posts=>[:comments, :author]}, :order=>"authors.id")
92
- assert_equal 2, authors.size
94
+ assert_equal 3, authors.size
93
95
  assert_equal 5, authors[0].posts.size
94
96
  assert_equal authors(:david).name, authors[0].name
95
97
  assert_equal [authors(:david).name], authors[0].posts.collect{|post| post.author.name}.uniq
@@ -139,14 +141,14 @@ class CascadedEagerLoadingTest < ActiveRecord::TestCase
139
141
 
140
142
  unless current_adapter?(:IBM_DBAdapter)
141
143
  def test_eager_association_loading_with_multiple_stis_and_order
142
- author = Author.find(:first, :include => { :posts => [ :special_comments , :very_special_comment ] }, :order => 'authors.name, comments.body, very_special_comments_posts.body', :conditions => 'posts.id = 4')
143
- assert_equal authors(:david), author
144
- assert_no_queries do
145
- author.posts.first.special_comments
146
- author.posts.first.very_special_comment
147
- end
144
+ author = Author.find(:first, :include => { :posts => [ :special_comments , :very_special_comment ] }, :order => ['authors.name', 'comments.body', 'very_special_comments_posts.body'], :conditions => 'posts.id = 4')
145
+ assert_equal authors(:david), author
146
+ assert_no_queries do
147
+ author.posts.first.special_comments
148
+ author.posts.first.very_special_comment
149
+ end
148
150
  end
149
- end
151
+ end
150
152
 
151
153
  def test_eager_association_loading_of_stis_with_multiple_references
152
154
  authors = Author.find(:all, :include => { :posts => { :special_comments => { :post => [ :special_comments, :very_special_comment ] } } }, :order => 'comments.body, very_special_comments_posts.body', :conditions => 'posts.id = 4')
@@ -159,9 +161,9 @@ class CascadedEagerLoadingTest < ActiveRecord::TestCase
159
161
 
160
162
  def test_eager_association_loading_where_first_level_returns_nil
161
163
  authors = Author.find(:all, :include => {:post_about_thinking => :comments}, :order => 'authors.id DESC')
162
- assert_equal [authors(:mary), authors(:david)], authors
164
+ assert_equal [authors(:bob), authors(:mary), authors(:david)], authors
163
165
  assert_no_queries do
164
- authors[1].post_about_thinking.comments.first
166
+ authors[2].post_about_thinking.comments.first
165
167
  end
166
168
  end
167
169
  end
@@ -72,22 +72,7 @@ class DeveloperWithCounterSQL < ActiveRecord::Base
72
72
  :join_table => "developers_projects",
73
73
  :association_foreign_key => "project_id",
74
74
  :foreign_key => "developer_id",
75
- :counter_sql => 'SELECT COUNT(*) AS count_all FROM projects INNER JOIN developers_projects ON projects.id = developers_projects.project_id WHERE developers_projects.developer_id =#{id}'
76
- end
77
-
78
- if current_adapter?(:IBM_DBAdapter)
79
- class Novel < ActiveRecord::Base
80
- has_and_belongs_to_many :writers
81
- end
82
-
83
- class Writer < ActiveRecord::Base
84
- has_and_belongs_to_many :novels
85
- end
86
-
87
- class NovelsWriter < ActiveRecord::Base
88
- belongs_to :writers
89
- belongs_to :novels
90
- end
75
+ :counter_sql => proc { "SELECT COUNT(*) AS count_all FROM projects INNER JOIN developers_projects ON projects.id = developers_projects.project_id WHERE developers_projects.developer_id =#{id}" }
91
76
  end
92
77
 
93
78
  class HasAndBelongsToManyAssociationsTest < ActiveRecord::TestCase
@@ -115,37 +100,12 @@ class HasAndBelongsToManyAssociationsTest < ActiveRecord::TestCase
115
100
  assert_equal 'c1', record[0]
116
101
  assert_equal 't1', record[1]
117
102
  end
118
-
119
- def test_should_record_timestamp_for_join_table
103
+
104
+ def test_proper_usage_of_primary_keys_and_join_table
120
105
  setup_data_for_habtm_case
121
106
 
122
- con = ActiveRecord::Base.connection
123
- sql = 'select * from countries_treaties'
124
- record = con.select_rows(sql).last
125
- assert_not_nil record[2]
126
- assert_not_nil record[3]
127
- if current_adapter?(:Mysql2Adapter, :OracleAdapter)
128
- assert_match %r{\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}}, record[2].to_s(:db)
129
- assert_match %r{\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}}, record[3].to_s(:db)
130
- else
131
- assert_match %r{\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}}, record[2]
132
- assert_match %r{\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}}, record[3]
133
- end
134
- end
135
-
136
- def test_should_record_timestamp_for_join_table_only_if_timestamp_should_be_recorded
137
- begin
138
- Treaty.record_timestamps = false
139
- setup_data_for_habtm_case
140
-
141
- con = ActiveRecord::Base.connection
142
- sql = 'select * from countries_treaties'
143
- record = con.select_rows(sql).last
144
- assert_nil record[2]
145
- assert_nil record[3]
146
- ensure
147
- Treaty.record_timestamps = true
148
- end
107
+ country = Country.first
108
+ assert_equal 1, country.treaties.count
149
109
  end
150
110
 
151
111
  def test_has_and_belongs_to_many
@@ -233,34 +193,6 @@ class HasAndBelongsToManyAssociationsTest < ActiveRecord::TestCase
233
193
  assert_equal 2, aredridel.projects(true).size
234
194
  end
235
195
 
236
- def test_adding_uses_default_values_on_join_table
237
- ac = projects(:action_controller)
238
- assert !developers(:jamis).projects.include?(ac)
239
- developers(:jamis).projects << ac
240
-
241
- assert developers(:jamis, :reload).projects.include?(ac)
242
- project = developers(:jamis).projects.detect { |p| p == ac }
243
- assert_equal 1, project.access_level.to_i
244
- end
245
-
246
- def test_habtm_attribute_access_and_respond_to
247
- project = developers(:jamis).projects[0]
248
- assert project.has_attribute?("name")
249
- assert project.has_attribute?("joined_on")
250
- assert project.has_attribute?("access_level")
251
- assert project.respond_to?("name")
252
- assert project.respond_to?("name=")
253
- assert project.respond_to?("name?")
254
- assert project.respond_to?("joined_on")
255
- # given that the 'join attribute' won't be persisted, I don't
256
- # think we should define the mutators
257
- #assert project.respond_to?("joined_on=")
258
- assert project.respond_to?("joined_on?")
259
- assert project.respond_to?("access_level")
260
- #assert project.respond_to?("access_level=")
261
- assert project.respond_to?("access_level?")
262
- end
263
-
264
196
  def test_habtm_adding_before_save
265
197
  no_of_devels = Developer.count
266
198
  no_of_projects = Project.count
@@ -310,9 +242,24 @@ class HasAndBelongsToManyAssociationsTest < ActiveRecord::TestCase
310
242
  assert_equal Developer.find(1).projects.sort_by(&:id).last, proj # prove join table is updated
311
243
  end
312
244
 
245
+ def test_new_aliased_to_build
246
+ devel = Developer.find(1)
247
+ proj = assert_no_queries { devel.projects.new("name" => "Projekt") }
248
+ assert !devel.projects.loaded?
249
+
250
+ assert_equal devel.projects.last, proj
251
+ assert devel.projects.loaded?
252
+
253
+ assert !proj.persisted?
254
+ devel.save
255
+ assert proj.persisted?
256
+ assert_equal devel.projects.last, proj
257
+ assert_equal Developer.find(1).projects.sort_by(&:id).last, proj # prove join table is updated
258
+ end
259
+
313
260
  def test_build_by_new_record
314
261
  devel = Developer.new(:name => "Marcel", :salary => 75000)
315
- proj1 = devel.projects.build(:name => "Make bed")
262
+ devel.projects.build(:name => "Make bed")
316
263
  proj2 = devel.projects.build(:name => "Lie in it")
317
264
  assert_equal devel.projects.last, proj2
318
265
  assert !proj2.persisted?
@@ -335,42 +282,9 @@ class HasAndBelongsToManyAssociationsTest < ActiveRecord::TestCase
335
282
  assert_equal Developer.find(1).projects.sort_by(&:id).last, proj # prove join table is updated
336
283
  end
337
284
 
338
- if current_adapter?(:IBM_DBAdapter)
339
- def test_lob_handling
340
- assert_nothing_raised do
341
- Novel.connection.create_table 'novels' do |t|
342
- t.text :story
343
- t.string :title
344
- end
345
- Writer.connection.create_table 'writers' do |t|
346
- t.string :name
347
- end
348
- NovelsWriter.connection.create_table 'novels_writers' do |t|
349
- t.belongs_to :novels
350
- t.belongs_to :writers
351
- end
352
- end
353
-
354
- w = Writer.new :name => 'Praveen'
355
- w.save!
356
-
357
- novel_story = "This is a short and sweet story"
358
-
359
- novel = Novel.new :story => novel_story,:title => "Cool isn't it"
360
- novel.writers << w
361
- novel.save!
362
-
363
- assert_equal novel_story,Novel.find(novel.id).story
364
- ensure
365
- Novel.connection.drop_table 'novels' rescue nil
366
- Writer.connection.drop_table 'writers' rescue nil
367
- NovelsWriter.connection.drop_table 'novels_writers' rescue nil
368
- end
369
- end
370
-
371
285
  def test_create_by_new_record
372
286
  devel = Developer.new(:name => "Marcel", :salary => 75000)
373
- proj1 = devel.projects.build(:name => "Make bed")
287
+ devel.projects.build(:name => "Make bed")
374
288
  proj2 = devel.projects.build(:name => "Lie in it")
375
289
  assert_equal devel.projects.last, proj2
376
290
  assert !proj2.persisted?
@@ -473,38 +387,41 @@ class HasAndBelongsToManyAssociationsTest < ActiveRecord::TestCase
473
387
  def test_removing_associations_on_destroy
474
388
  david = DeveloperWithBeforeDestroyRaise.find(1)
475
389
  assert !david.projects.empty?
476
- assert_raise(RuntimeError) { david.destroy }
390
+ david.destroy
477
391
  assert david.projects.empty?
478
392
  assert DeveloperWithBeforeDestroyRaise.connection.select_all("SELECT * FROM developers_projects WHERE developer_id = 1").empty?
479
393
  end
480
394
 
481
- def test_additional_columns_from_join_table
482
- assert_date_from_db Date.new(2004, 10, 10), Developer.find(1).projects.first.joined_on.to_date
483
- end
484
-
485
395
  def test_destroying
486
396
  david = Developer.find(1)
487
- active_record = Project.find(1)
397
+ project = Project.find(1)
488
398
  david.projects.reload
489
399
  assert_equal 2, david.projects.size
490
- assert_equal 3, active_record.developers.size
400
+ assert_equal 3, project.developers.size
491
401
 
492
- assert_difference "Project.count", -1 do
493
- david.projects.destroy(active_record)
402
+ assert_no_difference "Project.count" do
403
+ david.projects.destroy(project)
494
404
  end
495
405
 
406
+ join_records = Developer.connection.select_all("SELECT * FROM developers_projects WHERE developer_id = #{david.id} AND project_id = #{project.id}")
407
+ assert join_records.empty?
408
+
496
409
  assert_equal 1, david.reload.projects.size
497
410
  assert_equal 1, david.projects(true).size
498
411
  end
499
412
 
500
- def test_destroying_array
413
+ def test_destroying_many
501
414
  david = Developer.find(1)
502
415
  david.projects.reload
416
+ projects = Project.all
503
417
 
504
- assert_difference "Project.count", -Project.count do
505
- david.projects.destroy(Project.find(:all))
418
+ assert_no_difference "Project.count" do
419
+ david.projects.destroy(*projects)
506
420
  end
507
421
 
422
+ join_records = Developer.connection.select_all("SELECT * FROM developers_projects WHERE developer_id = #{david.id}")
423
+ assert join_records.empty?
424
+
508
425
  assert_equal 0, david.reload.projects.size
509
426
  assert_equal 0, david.projects(true).size
510
427
  end
@@ -513,7 +430,14 @@ class HasAndBelongsToManyAssociationsTest < ActiveRecord::TestCase
513
430
  david = Developer.find(1)
514
431
  david.projects.reload
515
432
  assert !david.projects.empty?
516
- david.projects.destroy_all
433
+
434
+ assert_no_difference "Project.count" do
435
+ david.projects.destroy_all
436
+ end
437
+
438
+ join_records = Developer.connection.select_all("SELECT * FROM developers_projects WHERE developer_id = #{david.id}")
439
+ assert join_records.empty?
440
+
517
441
  assert david.projects.empty?
518
442
  assert david.projects(true).empty?
519
443
  end
@@ -607,8 +531,6 @@ class HasAndBelongsToManyAssociationsTest < ActiveRecord::TestCase
607
531
 
608
532
  def test_dynamic_find_should_respect_association_order
609
533
  # Developers are ordered 'name DESC, id DESC'
610
- low_id_jamis = developers(:jamis)
611
- middle_id_jamis = developers(:poor_jamis)
612
534
  high_id_jamis = projects(:active_record).developers.create(:name => 'Jamis')
613
535
 
614
536
  assert_equal high_id_jamis, projects(:active_record).developers.find(:first, :conditions => "name = 'Jamis'")
@@ -704,7 +626,7 @@ class HasAndBelongsToManyAssociationsTest < ActiveRecord::TestCase
704
626
  project = SpecialProject.create("name" => "Special Project")
705
627
  assert developer.save
706
628
  developer.projects << project
707
- developer.update_attribute("name", "Bruza")
629
+ developer.update_column("name", "Bruza")
708
630
  assert_equal 1, Developer.connection.select_value(<<-end_sql).to_i
709
631
  SELECT count(*) FROM developers_projects
710
632
  WHERE project_id = #{project.id}
@@ -725,25 +647,6 @@ class HasAndBelongsToManyAssociationsTest < ActiveRecord::TestCase
725
647
  assert_respond_to categories(:technology).select_testing_posts.find(:first), :correctness_marker
726
648
  end
727
649
 
728
- def test_updating_attributes_on_rich_associations
729
- david = projects(:action_controller).developers.first
730
- david.name = "DHH"
731
- assert_raise(ActiveRecord::ReadOnlyRecord) { david.save! }
732
- end
733
-
734
- def test_updating_attributes_on_rich_associations_with_limited_find_from_reflection
735
- david = projects(:action_controller).selected_developers.first
736
- david.name = "DHH"
737
- assert_nothing_raised { david.save! }
738
- end
739
-
740
-
741
- def test_updating_attributes_on_rich_associations_with_limited_find
742
- david = projects(:action_controller).developers.find(:all, :select => "developers.*").first
743
- david.name = "DHH"
744
- assert david.save!
745
- end
746
-
747
650
  def test_join_table_alias
748
651
  assert_equal 3, Developer.find(:all, :include => {:projects => :developers}, :conditions => 'developers_projects_join.joined_on IS NOT NULL').size
749
652
  end
@@ -761,12 +664,12 @@ class HasAndBelongsToManyAssociationsTest < ActiveRecord::TestCase
761
664
  def test_find_grouped
762
665
  all_posts_from_category1 = Post.find(:all, :conditions => "category_id = 1", :joins => :categories)
763
666
  grouped_posts_of_category1 = Post.find(:all, :conditions => "category_id = 1", :group => "author_id", :select => 'count(posts.id) as posts_count', :joins => :categories)
764
- assert_equal 4, all_posts_from_category1.size
765
- assert_equal 1, grouped_posts_of_category1.size
667
+ assert_equal 5, all_posts_from_category1.size
668
+ assert_equal 2, grouped_posts_of_category1.size
766
669
  end
767
670
 
768
671
  def test_find_scoped_grouped
769
- assert_equal 4, categories(:general).posts_grouped_by_title.size
672
+ assert_equal 5, categories(:general).posts_grouped_by_title.size
770
673
  assert_equal 1, categories(:technology).posts_grouped_by_title.size
771
674
  end
772
675
 
@@ -846,12 +749,10 @@ class HasAndBelongsToManyAssociationsTest < ActiveRecord::TestCase
846
749
  }
847
750
  end
848
751
 
849
- unless current_adapter?(:IBM_DBAdapter) #refer SQL214n
850
- def test_dynamic_find_should_respect_association_include
851
- # SQL error in sort clause if :include is not included
852
- # due to Unknown column 'authors.id'
853
- assert Category.find(1).posts_with_authors_sorted_by_author_id.find_by_title('Welcome to the weblog')
854
- end
752
+ def test_dynamic_find_should_respect_association_include
753
+ # SQL error in sort clause if :include is not included
754
+ # due to Unknown column 'authors.id'
755
+ assert Category.find(1).posts_with_authors_sorted_by_author_id.find_by_title('Welcome to the weblog')
855
756
  end
856
757
 
857
758
  def test_counting_on_habtm_association_and_not_array
@@ -874,7 +775,7 @@ class HasAndBelongsToManyAssociationsTest < ActiveRecord::TestCase
874
775
  assert_equal 1, developer.projects.count
875
776
  end
876
777
 
877
- unless current_adapter?(:PostgreSQLAdapter)
778
+ unless current_adapter?(:PostgreSQLAdapter, :IBM_DBAdapter)
878
779
  def test_count_with_finder_sql
879
780
  assert_equal 3, projects(:active_record).developers_with_finder_sql.count
880
781
  assert_equal 3, projects(:active_record).developers_with_multiline_finder_sql.count
@@ -892,10 +793,13 @@ class HasAndBelongsToManyAssociationsTest < ActiveRecord::TestCase
892
793
  david = Developer.find(1)
893
794
  # clear cache possibly created by other tests
894
795
  david.projects.reset_column_information
895
- assert_queries(0) { david.projects.columns; david.projects.columns }
896
- # and again to verify that reset_column_information clears the cache correctly
796
+
797
+ # One query for columns, one for primary key
798
+ assert_queries(2) { david.projects.columns; david.projects.columns }
799
+
800
+ ## and again to verify that reset_column_information clears the cache correctly
897
801
  david.projects.reset_column_information
898
- assert_queries(0) { david.projects.columns; david.projects.columns }
802
+ assert_queries(2) { david.projects.columns; david.projects.columns }
899
803
  end
900
804
 
901
805
  def test_attributes_are_being_set_when_initialized_from_habm_association_with_where_clause