ibm_db 2.5.6 → 2.5.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) 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/test/cases/adapter_test.rb +25 -22
  9. data/test/cases/associations/belongs_to_associations_test.rb +245 -43
  10. data/test/cases/associations/cascaded_eager_loading_test.rb +28 -26
  11. data/test/cases/associations/has_and_belongs_to_many_associations_test.rb +60 -156
  12. data/test/cases/associations/join_model_test.rb +96 -146
  13. data/test/cases/attribute_methods_test.rb +98 -33
  14. data/test/cases/base_test.rb +525 -103
  15. data/test/cases/calculations_test.rb +92 -8
  16. data/test/cases/migration_test.rb +533 -207
  17. data/test/cases/persistence_test.rb +636 -0
  18. data/test/cases/query_cache_test.rb +242 -0
  19. data/test/cases/relations_test.rb +1019 -0
  20. data/test/cases/schema_dumper_test.rb +37 -17
  21. data/test/cases/transaction_callbacks_test.rb +300 -0
  22. data/test/cases/validations/uniqueness_validation_test.rb +38 -22
  23. data/test/cases/xml_serialization_test.rb +276 -0
  24. data/test/config.yml +154 -0
  25. data/test/connections/native_ibm_db/connection.rb +2 -0
  26. data/test/models/warehouse_thing.rb +4 -4
  27. data/test/schema/i5/ibm_db_specific_schema.rb +3 -1
  28. data/test/schema/ids/ibm_db_specific_schema.rb +3 -1
  29. data/test/schema/luw/ibm_db_specific_schema.rb +2 -0
  30. data/test/schema/schema.rb +174 -89
  31. data/test/schema/zOS/ibm_db_specific_schema.rb +3 -1
  32. metadata +14 -8
  33. data/test/cases/associations/eager_test.rb +0 -862
  34. data/test/cases/associations/has_many_through_associations_test.rb +0 -461
  35. data/test/cases/finder_test.rb +0 -1088
  36. data/test/cases/fixtures_test.rb +0 -684
@@ -1,3 +1,4 @@
1
+ =begin
1
2
  ActiveRecord::Schema.define do
2
3
 
3
4
  execute "DROP TABLE COMMENTS" rescue nil
@@ -132,4 +133,5 @@ execute <<_SQL
132
133
  );
133
134
  _SQL
134
135
 
135
- end
136
+ end
137
+ =end
@@ -1,3 +1,4 @@
1
+ =begin
1
2
  ActiveRecord::Schema.define do
2
3
 
3
4
  execute "DROP TABLE COMMENTS" rescue nil
@@ -135,4 +136,5 @@ execute <<_SQL
135
136
 
136
137
  _SQL
137
138
 
138
- end
139
+ end
140
+ =end
@@ -1,3 +1,4 @@
1
+ =begin
1
2
  ActiveRecord::Schema.define do
2
3
 
3
4
  execute "DROP TABLE COMMENTS" rescue nil
@@ -133,3 +134,4 @@ execute <<_SQL
133
134
  _SQL
134
135
 
135
136
  end
137
+ =end
@@ -18,8 +18,13 @@ ActiveRecord::Schema.define do
18
18
  end
19
19
 
20
20
 
21
- # Please keep these create table statements in alphabetical order
22
- # unless the ordering matters. In which case, define them below
21
+ # ------------------------------------------------------------------- #
22
+ # #
23
+ # Please keep these create table statements in alphabetical order #
24
+ # unless the ordering matters. In which case, define them below. #
25
+ # #
26
+ # ------------------------------------------------------------------- #
27
+
23
28
  create_table :accounts, :force => true do |t|
24
29
  t.integer :firm_id
25
30
  t.string :firm_name
@@ -35,6 +40,10 @@ ActiveRecord::Schema.define do
35
40
  t.references :account
36
41
  end
37
42
 
43
+ create_table :aircraft, :force => true do |t|
44
+ t.string :name
45
+ end
46
+
38
47
  create_table :audit_logs, :force => true do |t|
39
48
  t.column :message, :string, :null=>false
40
49
  t.column :developer_id, :integer, :null=>false
@@ -44,6 +53,8 @@ ActiveRecord::Schema.define do
44
53
  t.string :name, :null => false
45
54
  t.integer :author_address_id
46
55
  t.integer :author_address_extra_id
56
+ t.string :organization_id
57
+ t.string :owned_essay_id
47
58
  end
48
59
 
49
60
  create_table :author_addresses, :force => true do |t|
@@ -54,13 +65,13 @@ ActiveRecord::Schema.define do
54
65
  t.column :favorite_author_id, :integer
55
66
  end
56
67
 
57
-
58
68
  create_table :auto_id_tests, :force => true, :id => false do |t|
59
69
  t.primary_key :auto_id
60
70
  t.integer :value
61
71
  end
62
72
 
63
73
  create_table :binaries, :force => true do |t|
74
+ t.string :name
64
75
  t.binary :data
65
76
  end
66
77
 
@@ -71,6 +82,7 @@ ActiveRecord::Schema.define do
71
82
  end
72
83
 
73
84
  create_table :books, :force => true do |t|
85
+ t.integer :author_id
74
86
  t.column :name, :string
75
87
  end
76
88
 
@@ -78,7 +90,14 @@ ActiveRecord::Schema.define do
78
90
  t.boolean :value
79
91
  end
80
92
 
81
- create_table :camelcase, :force => true do |t|
93
+ create_table :bulbs, :force => true do |t|
94
+ t.integer :car_id
95
+ t.string :name
96
+ t.boolean :frickinawesome
97
+ t.string :color
98
+ end
99
+
100
+ create_table "camelcase", :force => true do |t|
82
101
  t.string :name
83
102
  end
84
103
 
@@ -101,8 +120,10 @@ ActiveRecord::Schema.define do
101
120
 
102
121
  create_table :categorizations, :force => true do |t|
103
122
  t.column :category_id, :integer
123
+ t.string :named_category_name
104
124
  t.column :post_id, :integer
105
125
  t.column :author_id, :integer
126
+ t.column :special, :boolean
106
127
  end
107
128
 
108
129
  create_table :citations, :force => true do |t|
@@ -112,6 +133,7 @@ ActiveRecord::Schema.define do
112
133
 
113
134
  create_table :clubs, :force => true do |t|
114
135
  t.string :name
136
+ t.integer :category_id
115
137
  end
116
138
 
117
139
  create_table :collections, :force => true do |t|
@@ -122,13 +144,19 @@ ActiveRecord::Schema.define do
122
144
  t.integer :references, :null => false
123
145
  end
124
146
 
125
- except 'IBM_DB' do
126
- create_table :comments, :force => true do |t|
127
- t.integer :post_id, :null => false
128
- t.text :body, :null => false
129
- t.string :type
147
+ create_table :comments, :force => true do |t|
148
+ t.integer :post_id, :null => false
149
+ # use VARCHAR2(4000) instead of CLOB datatype as CLOB data type has many limitations in
150
+ # Oracle SELECT WHERE clause which causes many unit test failures
151
+ if current_adapter?(:OracleAdapter) || current_adapter?(:IBM_DBAdapter)
152
+ t.string :body, :null => false, :limit => 4000
153
+ else
154
+ t.text :body, :null => false
130
155
  end
131
- end
156
+ t.string :type
157
+ t.integer :taggings_count, :default => 0
158
+ t.integer :children_count, :default => 0
159
+ end
132
160
 
133
161
  create_table :companies, :force => true do |t|
134
162
  t.string :type
@@ -138,6 +166,7 @@ ActiveRecord::Schema.define do
138
166
  t.string :name
139
167
  t.integer :client_of
140
168
  t.integer :rating, :default => 1
169
+ t.integer :account_id
141
170
  end
142
171
 
143
172
  add_index :companies, [:firm_id, :type, :rating, :ruby_type], :name => "company_index"
@@ -190,15 +219,6 @@ ActiveRecord::Schema.define do
190
219
  t.integer :car_id
191
220
  end
192
221
 
193
- create_table :tyres, :force => true do |t|
194
- t.integer :car_id
195
- end
196
-
197
- create_table :bulbs, :force => true do |t|
198
- t.integer :car_id
199
- t.string :name
200
- end
201
-
202
222
  create_table :entrants, :force => true do |t|
203
223
  t.string :name, :null => false
204
224
  t.integer :course_id, :null => false
@@ -208,30 +228,32 @@ ActiveRecord::Schema.define do
208
228
  t.string :name
209
229
  t.string :writer_id
210
230
  t.string :writer_type
231
+ t.string :category_id
232
+ t.string :author_id
211
233
  end
212
234
 
213
235
  create_table :events, :force => true do |t|
214
236
  t.string :title, :limit => 5
215
237
  end
216
238
 
239
+ create_table :eyes, :force => true do |t|
240
+ end
241
+
217
242
  create_table :funny_jokes, :force => true do |t|
218
243
  t.string :name
219
244
  end
220
245
 
246
+ create_table :cold_jokes, :force => true do |t|
247
+ t.string :name
248
+ end
249
+
221
250
  create_table :goofy_string_id, :force => true, :id => false do |t|
222
251
  t.string :id, :null => false
223
252
  t.string :info
224
253
  end
225
254
 
226
- create_table :invoices, :force => true do |t|
227
- t.integer :balance
228
- t.datetime :updated_at
229
- end
230
-
231
- except 'IBM_DB' do
232
- create_table :items, :force => true do |t|
233
- t.column :name, :string
234
- end
255
+ create_table :guids, :force => true do |t|
256
+ t.column :key, :string
235
257
  end
236
258
 
237
259
  create_table :inept_wizards, :force => true do |t|
@@ -240,6 +262,26 @@ ActiveRecord::Schema.define do
240
262
  t.column :type, :string
241
263
  end
242
264
 
265
+ create_table :integer_limits, :force => true do |t|
266
+ t.integer :"c_int_without_limit"
267
+ (1..8).each do |i|
268
+ t.integer :"c_int_#{i}", :limit => i
269
+ end
270
+ end
271
+
272
+ create_table :invoices, :force => true do |t|
273
+ t.integer :balance
274
+ t.datetime :updated_at
275
+ end
276
+
277
+ create_table :iris, :force => true do |t|
278
+ t.references :eye
279
+ t.string :color
280
+ end
281
+
282
+ create_table :items, :force => true do |t|
283
+ t.column :name, :string
284
+ end
243
285
 
244
286
  create_table :jobs, :force => true do |t|
245
287
  t.integer :ideal_reference_id
@@ -255,6 +297,15 @@ ActiveRecord::Schema.define do
255
297
  t.integer :version, :null => false, :default => 0
256
298
  end
257
299
 
300
+ create_table :lessons, :force => true do |t|
301
+ t.string :name
302
+ end
303
+
304
+ create_table :lessons_students, :id => false, :force => true do |t|
305
+ t.references :lesson
306
+ t.references :student
307
+ end
308
+
258
309
  create_table :line_items, :force => true do |t|
259
310
  t.integer :invoice_id
260
311
  t.integer :amount
@@ -296,13 +347,6 @@ ActiveRecord::Schema.define do
296
347
  t.string :name
297
348
  end
298
349
 
299
- create_table :references, :force => true do |t|
300
- t.integer :person_id
301
- t.integer :job_id
302
- t.boolean :favourite
303
- t.integer :lock_version, :default => 0
304
- end
305
-
306
350
  create_table :minivans, :force => true, :id => false do |t|
307
351
  t.string :minivan_id
308
352
  t.string :name
@@ -341,10 +385,10 @@ ActiveRecord::Schema.define do
341
385
  t.decimal :my_house_population, :precision => 2, :scale => 0
342
386
  t.decimal :decimal_number_with_default, :precision => 3, :scale => 2, :default => 2.78
343
387
  t.float :temperature
344
- # Oracle supports precision up to 38
345
- if current_adapter?(:OracleAdapter)
388
+ # Oracle/SQLServer supports precision up to 38
389
+ if current_adapter?(:OracleAdapter,:SQLServerAdapter)
346
390
  t.decimal :atoms_in_universe, :precision => 38, :scale => 0
347
- elsif current_adapter?(:IBM_DBAdapter)
391
+ elsif current_adapter?(:IBM_DBAdapter)
348
392
  t.decimal :atoms_in_universe, :precision => 31, :scale => 0
349
393
  else
350
394
  t.decimal :atoms_in_universe, :precision => 55, :scale => 0
@@ -365,16 +409,15 @@ ActiveRecord::Schema.define do
365
409
  t.string :name
366
410
  t.column :updated_at, :datetime
367
411
  t.column :happy_at, :datetime
412
+ t.string :essay_id
368
413
  end
369
414
 
370
- except 'IBM_DB' do
371
- create_table :paint_colors, :force => true do |t|
372
- t.integer :non_poly_one_id
373
- end
415
+ create_table :paint_colors, :force => true do |t|
416
+ t.integer :non_poly_one_id
417
+ end
374
418
 
375
- create_table :paint_textures, :force => true do |t|
376
- t.integer :non_poly_two_id
377
- end
419
+ create_table :paint_textures, :force => true do |t|
420
+ t.integer :non_poly_two_id
378
421
  end
379
422
 
380
423
  create_table :parrots, :force => true do |t|
@@ -403,11 +446,16 @@ ActiveRecord::Schema.define do
403
446
  t.string :gender, :limit => 1
404
447
  t.references :number1_fan
405
448
  t.integer :lock_version, :null => false, :default => 0
449
+ t.string :comments
450
+ t.references :best_friend
451
+ t.references :best_friend_of
452
+ t.timestamps
406
453
  end
407
454
 
408
455
  create_table :pets, :primary_key => :pet_id ,:force => true do |t|
409
456
  t.string :name
410
457
  t.integer :owner_id, :integer
458
+ t.timestamps
411
459
  end
412
460
 
413
461
  create_table :pirates, :force => true do |t|
@@ -417,16 +465,25 @@ ActiveRecord::Schema.define do
417
465
  t.column :updated_on, :datetime
418
466
  end
419
467
 
420
- except 'IBM_DB' do
421
- create_table :posts, :force => true do |t|
422
- t.integer :author_id
423
- t.string :title, :null => false
424
- t.text :body, :null => false
425
- t.string :type
426
- t.integer :comments_count, :default => 0
427
- t.integer :taggings_count, :default => 0
468
+ create_table :posts, :force => true do |t|
469
+ t.integer :author_id
470
+ t.string :title, :null => false
471
+ # use VARCHAR2(4000) instead of CLOB datatype as CLOB data type has many limitations in
472
+ # Oracle SELECT WHERE clause which causes many unit test failures
473
+ if current_adapter?(:OracleAdapter) || current_adapter?(:IBM_DBAdapter)
474
+ t.string :body, :null => false, :limit => 4000
475
+ else
476
+ t.text :body, :null => false
428
477
  end
429
- end
478
+ t.string :type
479
+ t.integer :comments_count, :default => 0
480
+ t.integer :taggings_count, :default => 0
481
+ t.integer :taggings_with_delete_all_count, :default => 0
482
+ t.integer :taggings_with_destroy_count, :default => 0
483
+ t.integer :tags_count, :default => 0
484
+ t.integer :tags_with_destroy_count, :default => 0
485
+ t.integer :tags_with_nullify_count, :default => 0
486
+ end
430
487
 
431
488
  create_table :price_estimates, :force => true do |t|
432
489
  t.string :estimate_of_type
@@ -444,12 +501,24 @@ ActiveRecord::Schema.define do
444
501
  t.string :type
445
502
  end
446
503
 
504
+ create_table :ratings, :force => true do |t|
505
+ t.integer :comment_id
506
+ t.integer :value
507
+ end
508
+
447
509
  create_table :readers, :force => true do |t|
448
510
  t.integer :post_id, :null => false
449
511
  t.integer :person_id, :null => false
450
512
  t.boolean :skimmer, :default => false
451
513
  end
452
514
 
515
+ create_table :references, :force => true do |t|
516
+ t.integer :person_id
517
+ t.integer :job_id
518
+ t.boolean :favourite
519
+ t.integer :lock_version, :default => 0
520
+ end
521
+
453
522
  create_table :shape_expressions, :force => true do |t|
454
523
  t.string :paint_type
455
524
  t.integer :paint_id
@@ -483,6 +552,16 @@ ActiveRecord::Schema.define do
483
552
  t.string :sponsorable_type
484
553
  end
485
554
 
555
+ create_table :string_key_objects, :id => false, :primary_key => :id, :force => true do |t|
556
+ t.string :id
557
+ t.string :name
558
+ t.integer :lock_version, :null => false, :default => 0
559
+ end
560
+
561
+ create_table :students, :force => true do |t|
562
+ t.string :name
563
+ end
564
+
486
565
  create_table :subscribers, :force => true, :id => false do |t|
487
566
  t.string :nick, :null => false
488
567
  t.string :name
@@ -494,43 +573,51 @@ ActiveRecord::Schema.define do
494
573
  t.integer :book_id
495
574
  end
496
575
 
497
- create_table :tasks, :force => true do |t|
498
- t.datetime :starting
499
- t.datetime :ending
576
+ create_table :tags, :force => true do |t|
577
+ t.column :name, :string
578
+ t.column :taggings_count, :integer, :default => 0
500
579
  end
501
580
 
502
- except 'IBM_DB' do
503
- create_table :topics, :force => true do |t|
504
- t.string :title
505
- t.string :author_name
506
- t.string :author_email_address
507
- t.datetime :written_on
508
- t.time :bonus_time
509
- t.date :last_read
510
- t.text :content
511
- t.boolean :approved, :default => true
512
- t.integer :replies_count, :default => 0
513
- t.integer :parent_id
514
- t.string :parent_title
515
- t.string :type
516
- end
517
- end
518
-
519
581
  create_table :taggings, :force => true do |t|
520
582
  t.column :tag_id, :integer
521
583
  t.column :super_tag_id, :integer
522
584
  t.column :taggable_type, :string
523
585
  t.column :taggable_id, :integer
586
+ t.string :comment
524
587
  end
525
588
 
526
- create_table :tags, :force => true do |t|
527
- t.column :name, :string
528
- t.column :taggings_count, :integer, :default => 0
589
+ create_table :tasks, :force => true do |t|
590
+ t.datetime :starting
591
+ t.datetime :ending
592
+ end
593
+
594
+ create_table :topics, :force => true do |t|
595
+ t.string :title
596
+ t.string :author_name
597
+ t.string :author_email_address
598
+ t.datetime :written_on
599
+ t.time :bonus_time
600
+ t.date :last_read
601
+ # use VARCHAR2(4000) instead of CLOB datatype as CLOB data type has many limitations in
602
+ # Oracle SELECT WHERE clause which causes many unit test failures
603
+ if current_adapter?(:OracleAdapter) || current_adapter?(:IBM_DBAdapter)
604
+ t.string :content, :limit => 4000
605
+ else
606
+ t.text :content
607
+ end
608
+ t.boolean :approved, :default => true
609
+ t.integer :replies_count, :default => 0
610
+ t.integer :parent_id
611
+ t.string :parent_title
612
+ t.string :type
613
+ t.string :group
614
+ t.timestamps
529
615
  end
530
616
 
531
617
  create_table :toys, :primary_key => :toy_id ,:force => true do |t|
532
618
  t.string :name
533
619
  t.integer :pet_id, :integer
620
+ t.timestamps
534
621
  end
535
622
 
536
623
  create_table :traffic_lights, :force => true do |t|
@@ -546,6 +633,10 @@ ActiveRecord::Schema.define do
546
633
  t.column :looter_type, :string
547
634
  end
548
635
 
636
+ create_table :tyres, :force => true do |t|
637
+ t.integer :car_id
638
+ end
639
+
549
640
  create_table :variants, :force => true do |t|
550
641
  t.references :product
551
642
  t.string :name
@@ -563,17 +654,6 @@ ActiveRecord::Schema.define do
563
654
  create_table(t, :force => true) { }
564
655
  end
565
656
 
566
- create_table :guids, :force => true do |t|
567
- t.column :key, :string
568
- end
569
-
570
- create_table :integer_limits, :force => true do |t|
571
- t.integer :"c_int_without_limit"
572
- (1..8).each do |i|
573
- t.integer :"c_int_#{i}", :limit => i
574
- end
575
- end
576
-
577
657
  # NOTE - the following 4 tables are used by models that have :inverse_of options on the associations
578
658
  create_table :men, :force => true do |t|
579
659
  t.string :name
@@ -628,8 +708,11 @@ ActiveRecord::Schema.define do
628
708
  t.integer :molecule_id
629
709
  t.string :name
630
710
  end
711
+ create_table :weirds, :force => true do |t|
712
+ t.string 'a$b'
713
+ end
631
714
 
632
- except ['SQLite','IBM_DB'] do
715
+ except 'SQLite' do
633
716
  # fk_test_has_fk should be before fk_test_has_pk
634
717
  create_table :fk_test_has_fk, :force => true do |t|
635
718
  t.integer :fk_id, :null => false
@@ -639,6 +722,8 @@ ActiveRecord::Schema.define do
639
722
  end
640
723
 
641
724
  execute "ALTER TABLE fk_test_has_fk ADD CONSTRAINT fk_name FOREIGN KEY (#{quote_column_name 'fk_id'}) REFERENCES #{quote_table_name 'fk_test_has_pk'} (#{quote_column_name 'id'})"
725
+
726
+ execute "ALTER TABLE lessons_students ADD CONSTRAINT student_id_fk FOREIGN KEY (#{quote_column_name 'student_id'}) REFERENCES #{quote_table_name 'students'} (#{quote_column_name 'id'})"
642
727
  end
643
728
  end
644
729