ibm_db 1.1.1-mswin32

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 +155 -0
  2. data/LICENSE +18 -0
  3. data/MANIFEST +14 -0
  4. data/README +274 -0
  5. data/ext/Makefile.nt32 +181 -0
  6. data/ext/extconf.rb +58 -0
  7. data/ext/ibm_db.c +6553 -0
  8. data/ext/ruby_ibm_db.h +214 -0
  9. data/init.rb +42 -0
  10. data/lib/IBM_DB.rb +2 -0
  11. data/lib/active_record/connection_adapters/ibm_db_adapter.rb +2218 -0
  12. data/lib/active_record/vendor/db2-i5-zOS.yaml +328 -0
  13. data/lib/mswin32/ibm_db.so +0 -0
  14. data/test/cases/adapter_test.rb +180 -0
  15. data/test/cases/associations/cascaded_eager_loading_test.rb +133 -0
  16. data/test/cases/associations/eager_test.rb +842 -0
  17. data/test/cases/associations/has_and_belongs_to_many_associations_test.rb +874 -0
  18. data/test/cases/associations/has_many_through_associations_test.rb +281 -0
  19. data/test/cases/associations/join_model_test.rb +801 -0
  20. data/test/cases/attribute_methods_test.rb +312 -0
  21. data/test/cases/base_test.rb +2114 -0
  22. data/test/cases/calculations_test.rb +346 -0
  23. data/test/cases/finder_test.rb +1092 -0
  24. data/test/cases/fixtures_test.rb +660 -0
  25. data/test/cases/migration_test.rb +1618 -0
  26. data/test/cases/schema_dumper_test.rb +197 -0
  27. data/test/cases/validations_test.rb +1604 -0
  28. data/test/connections/native_ibm_db/connection.rb +40 -0
  29. data/test/ibm_db_test.rb +25 -0
  30. data/test/models/warehouse_thing.rb +5 -0
  31. data/test/schema/i5/ibm_db_specific_schema.rb +134 -0
  32. data/test/schema/ids/ibm_db_specific_schema.rb +137 -0
  33. data/test/schema/luw/ibm_db_specific_schema.rb +134 -0
  34. data/test/schema/schema.rb +499 -0
  35. data/test/schema/zOS/ibm_db_specific_schema.rb +205 -0
  36. metadata +115 -0
@@ -0,0 +1,499 @@
1
+
2
+ ActiveRecord::Schema.define do
3
+ def except(adapter_names_to_exclude)
4
+ unless [adapter_names_to_exclude].flatten.include?(adapter_name)
5
+ yield
6
+ end
7
+ end
8
+
9
+ #put adapter specific setup here
10
+ case adapter_name
11
+ # For Firebird, set the sequence values 10000 when create_table is called;
12
+ # this prevents primary key collisions between "normally" created records
13
+ # and fixture-based (YAML) records.
14
+ when "Firebird"
15
+ def create_table(*args, &block)
16
+ ActiveRecord::Base.connection.create_table(*args, &block)
17
+ ActiveRecord::Base.connection.execute "SET GENERATOR #{args.first}_seq TO 10000"
18
+ end
19
+ end
20
+
21
+
22
+ # Please keep these create table statements in alphabetical order
23
+ # unless the ordering matters. In which case, define them below
24
+ create_table :accounts, :force => true do |t|
25
+ t.integer :firm_id
26
+ t.integer :credit_limit
27
+ end
28
+
29
+ create_table :audit_logs, :force => true do |t|
30
+ t.column :message, :string, :null=>false
31
+ t.column :developer_id, :integer, :null=>false
32
+ end
33
+
34
+ create_table :authors, :force => true do |t|
35
+ t.string :name, :null => false
36
+ t.integer :author_address_id
37
+ t.integer :author_address_extra_id
38
+ end
39
+
40
+ create_table :author_addresses, :force => true do |t|
41
+ end
42
+
43
+ create_table :author_favorites, :force => true do |t|
44
+ t.column :author_id, :integer
45
+ t.column :favorite_author_id, :integer
46
+ end
47
+
48
+
49
+ create_table :auto_id_tests, :force => true, :id => false do |t|
50
+ t.primary_key :auto_id
51
+ t.integer :value
52
+ end
53
+
54
+ create_table :binaries, :force => true do |t|
55
+ t.binary :data
56
+ end
57
+
58
+ create_table :birds, :force => true do |t|
59
+ t.string :name
60
+ t.integer :pirate_id
61
+ end
62
+
63
+ create_table :books, :force => true do |t|
64
+ t.column :name, :string
65
+ end
66
+
67
+ create_table :booleantests, :force => true do |t|
68
+ t.boolean :value
69
+ end
70
+
71
+ create_table :camelcase, :force => true do |t|
72
+ t.string :name
73
+ end
74
+
75
+ create_table :categories, :force => true do |t|
76
+ t.string :name, :null => false
77
+ t.string :type
78
+ t.integer :categorizations_count
79
+ end
80
+
81
+ create_table :categories_posts, :force => true, :id => false do |t|
82
+ t.integer :category_id, :null => false
83
+ t.integer :post_id, :null => false
84
+ end
85
+
86
+ create_table :categorizations, :force => true do |t|
87
+ t.column :category_id, :integer
88
+ t.column :post_id, :integer
89
+ t.column :author_id, :integer
90
+ end
91
+
92
+ create_table :citations, :force => true do |t|
93
+ t.column :book1_id, :integer
94
+ t.column :book2_id, :integer
95
+ end
96
+
97
+ create_table :clubs, :force => true do |t|
98
+ t.string :name
99
+ end
100
+
101
+ create_table :colnametests, :force => true do |t|
102
+ t.integer :references, :null => false
103
+ end
104
+
105
+ except 'IBM_DB' do
106
+ create_table :comments, :force => true do |t|
107
+ t.integer :post_id, :null => false
108
+ t.text :body, :null => false
109
+ t.string :type
110
+ end
111
+ end
112
+
113
+ create_table :companies, :force => true do |t|
114
+ t.string :type
115
+ t.string :ruby_type
116
+ t.integer :firm_id
117
+ t.string :firm_name
118
+ t.string :name
119
+ t.integer :client_of
120
+ t.integer :rating, :default => 1
121
+ end
122
+
123
+ add_index :companies, [:firm_id, :type, :rating, :ruby_type], :name => "company_index"
124
+
125
+ create_table :computers, :force => true do |t|
126
+ t.integer :developer, :null => false
127
+ t.integer :extendedWarranty, :null => false
128
+ end
129
+
130
+
131
+ create_table :customers, :force => true do |t|
132
+ t.string :name
133
+ t.integer :balance, :default => 0
134
+ t.string :address_street
135
+ t.string :address_city
136
+ t.string :address_country
137
+ t.string :gps_location
138
+ end
139
+
140
+ create_table :developers, :force => true do |t|
141
+ t.string :name
142
+ t.integer :salary, :default => 70000
143
+ t.datetime :created_at
144
+ t.datetime :updated_at
145
+ end
146
+
147
+ create_table :developers_projects, :force => true, :id => false do |t|
148
+ t.integer :developer_id, :null => false
149
+ t.integer :project_id, :null => false
150
+ t.date :joined_on
151
+ t.integer :access_level, :default => 1
152
+ end
153
+
154
+ create_table :edges, :force => true do |t|
155
+ t.column :source_id, :integer, :null => false
156
+ t.column :sink_id, :integer, :null => false
157
+ end
158
+ add_index :edges, [:source_id, :sink_id], :unique => true, :name => 'unique_edge_index'
159
+
160
+
161
+ create_table :entrants, :force => true do |t|
162
+ t.string :name, :null => false
163
+ t.integer :course_id, :null => false
164
+ end
165
+
166
+ create_table :essays, :force => true do |t|
167
+ t.string :name
168
+ t.string :writer_id
169
+ t.string :writer_type
170
+ end
171
+
172
+ create_table :events, :force => true do |t|
173
+ t.string :title, :limit => 5
174
+ end
175
+
176
+ create_table :funny_jokes, :force => true do |t|
177
+ t.string :name
178
+ end
179
+
180
+ create_table :goofy_string_id, :force => true, :id => false do |t|
181
+ t.string :id, :null => false
182
+ t.string :info
183
+ end
184
+
185
+ except 'IBM_DB' do
186
+ create_table :items, :force => true do |t|
187
+ t.column :name, :string
188
+ end
189
+ end
190
+
191
+ create_table :inept_wizards, :force => true do |t|
192
+ t.column :name, :string, :null => false
193
+ t.column :city, :string, :null => false
194
+ t.column :type, :string
195
+ end
196
+
197
+
198
+ create_table :jobs, :force => true do |t|
199
+ t.integer :ideal_reference_id
200
+ end
201
+
202
+ create_table :keyboards, :force => true, :id => false do |t|
203
+ t.primary_key :key_number
204
+ t.string :name
205
+ end
206
+
207
+ create_table :legacy_things, :force => true do |t|
208
+ t.integer :tps_report_number
209
+ t.integer :version, :null => false, :default => 0
210
+ end
211
+
212
+ create_table :lock_without_defaults, :force => true do |t|
213
+ t.column :lock_version, :integer
214
+ end
215
+
216
+ create_table :lock_without_defaults_cust, :force => true do |t|
217
+ t.column :custom_lock_version, :integer
218
+ end
219
+
220
+ create_table :mateys, :id => false, :force => true do |t|
221
+ t.column :pirate_id, :integer
222
+ t.column :target_id, :integer
223
+ t.column :weight, :integer
224
+ end
225
+
226
+ create_table :members, :force => true do |t|
227
+ t.string :name
228
+ t.integer :member_type_id
229
+ end
230
+
231
+ create_table :member_details, :force => true do |t|
232
+ t.integer :member_id
233
+ t.integer :organization_id
234
+ t.string :extra_data
235
+ end
236
+
237
+ create_table :memberships, :force => true do |t|
238
+ t.datetime :joined_on
239
+ t.integer :club_id, :member_id
240
+ t.boolean :favourite, :default => false
241
+ t.string :type
242
+ end
243
+
244
+ create_table :member_types, :force => true do |t|
245
+ t.string :name
246
+ end
247
+
248
+ create_table :references, :force => true do |t|
249
+ t.integer :person_id
250
+ t.integer :job_id
251
+ t.boolean :favourite
252
+ t.integer :lock_version, :default => 0
253
+ end
254
+
255
+ create_table :minimalistics, :force => true do |t|
256
+ end
257
+
258
+ create_table :mixed_case_monkeys, :force => true, :id => false do |t|
259
+ t.primary_key :monkeyID
260
+ t.integer :fleaCount
261
+ end
262
+
263
+ create_table :mixins, :force => true do |t|
264
+ t.integer :parent_id
265
+ t.integer :pos
266
+ t.datetime :created_at
267
+ t.datetime :updated_at
268
+ t.integer :lft
269
+ t.integer :rgt
270
+ t.integer :root_id
271
+ t.string :type
272
+ end
273
+
274
+ create_table :movies, :force => true, :id => false do |t|
275
+ t.primary_key :movieid
276
+ t.string :name
277
+ end
278
+
279
+ create_table :numeric_data, :force => true do |t|
280
+ t.decimal :bank_balance, :precision => 10, :scale => 2
281
+ t.decimal :big_bank_balance, :precision => 15, :scale => 2
282
+ t.decimal :world_population, :precision => 10, :scale => 0
283
+ t.decimal :my_house_population, :precision => 2, :scale => 0
284
+ t.decimal :decimal_number_with_default, :precision => 3, :scale => 2, :default => 2.78
285
+ t.float :temperature
286
+ end
287
+
288
+ create_table :orders, :force => true do |t|
289
+ t.string :name
290
+ t.integer :billing_customer_id
291
+ t.integer :shipping_customer_id
292
+ end
293
+
294
+ create_table :organizations, :force => true do |t|
295
+ t.string :name
296
+ end
297
+
298
+ create_table :owners, :primary_key => :owner_id ,:force => true do |t|
299
+ t.string :name
300
+ t.column :updated_at, :datetime
301
+ t.column :happy_at, :datetime
302
+ end
303
+
304
+ except 'IBM_DB' do
305
+ create_table :paint_colors, :force => true do |t|
306
+ t.integer :non_poly_one_id
307
+ end
308
+
309
+ create_table :paint_textures, :force => true do |t|
310
+ t.integer :non_poly_two_id
311
+ end
312
+ end
313
+
314
+ create_table :parrots, :force => true do |t|
315
+ t.column :name, :string
316
+ t.column :parrot_sti_class, :string
317
+ t.column :killer_id, :integer
318
+ t.column :created_at, :datetime
319
+ t.column :created_on, :datetime
320
+ t.column :updated_at, :datetime
321
+ t.column :updated_on, :datetime
322
+ end
323
+
324
+ create_table :parrots_pirates, :id => false, :force => true do |t|
325
+ t.column :parrot_id, :integer
326
+ t.column :pirate_id, :integer
327
+ end
328
+
329
+ create_table :parrots_treasures, :id => false, :force => true do |t|
330
+ t.column :parrot_id, :integer
331
+ t.column :treasure_id, :integer
332
+ end
333
+
334
+ create_table :people, :force => true do |t|
335
+ t.string :first_name, :null => false
336
+ t.references :primary_contact
337
+ t.string :gender, :limit => 1
338
+ t.integer :lock_version, :null => false, :default => 0
339
+ end
340
+
341
+ create_table :pets, :primary_key => :pet_id ,:force => true do |t|
342
+ t.string :name
343
+ t.integer :owner_id, :integer
344
+ end
345
+
346
+ create_table :pirates, :force => true do |t|
347
+ t.column :catchphrase, :string
348
+ t.column :parrot_id, :integer
349
+ t.column :created_on, :datetime
350
+ t.column :updated_on, :datetime
351
+ end
352
+
353
+ except 'IBM_DB' do
354
+ create_table :posts, :force => true do |t|
355
+ t.integer :author_id
356
+ t.string :title, :null => false
357
+ t.text :body, :null => false
358
+ t.string :type
359
+ t.integer :comments_count, :default => 0
360
+ t.integer :taggings_count, :default => 0
361
+ end
362
+ end
363
+
364
+ create_table :price_estimates, :force => true do |t|
365
+ t.string :estimate_of_type
366
+ t.integer :estimate_of_id
367
+ t.integer :price
368
+ end
369
+
370
+ create_table :projects, :force => true do |t|
371
+ t.string :name
372
+ t.string :type
373
+ end
374
+
375
+ create_table :readers, :force => true do |t|
376
+ t.integer :post_id, :null => false
377
+ t.integer :person_id, :null => false
378
+ end
379
+
380
+ create_table :shape_expressions, :force => true do |t|
381
+ t.string :paint_type
382
+ t.integer :paint_id
383
+ t.string :shape_type
384
+ t.integer :shape_id
385
+ end
386
+
387
+ create_table :ships, :force => true do |t|
388
+ t.string :name
389
+ t.integer :pirate_id
390
+ t.datetime :created_at
391
+ t.datetime :created_on
392
+ t.datetime :updated_at
393
+ t.datetime :updated_on
394
+ end
395
+
396
+ create_table :ship_parts, :force => true do |t|
397
+ t.string :name
398
+ t.integer :ship_id
399
+ end
400
+
401
+ create_table :sponsors, :force => true do |t|
402
+ t.integer :club_id
403
+ t.integer :sponsorable_id
404
+ t.string :sponsorable_type
405
+ end
406
+
407
+ create_table :subscribers, :force => true, :id => false do |t|
408
+ t.string :nick, :null => false
409
+ t.string :name
410
+ end
411
+ add_index :subscribers, :nick, :unique => true
412
+
413
+ create_table :subscriptions, :force => true do |t|
414
+ t.string :subscriber_id
415
+ t.integer :book_id
416
+ end
417
+
418
+ create_table :tasks, :force => true do |t|
419
+ t.datetime :starting
420
+ t.datetime :ending
421
+ end
422
+
423
+ except 'IBM_DB' do
424
+ create_table :topics, :force => true do |t|
425
+ t.string :title
426
+ t.string :author_name
427
+ t.string :author_email_address
428
+ t.datetime :written_on
429
+ t.time :bonus_time
430
+ t.date :last_read
431
+ t.text :content
432
+ t.boolean :approved, :default => true
433
+ t.integer :replies_count, :default => 0
434
+ t.integer :parent_id
435
+ t.string :parent_title
436
+ t.string :type
437
+ end
438
+ end
439
+
440
+ create_table :taggings, :force => true do |t|
441
+ t.column :tag_id, :integer
442
+ t.column :super_tag_id, :integer
443
+ t.column :taggable_type, :string
444
+ t.column :taggable_id, :integer
445
+ end
446
+
447
+ create_table :tags, :force => true do |t|
448
+ t.column :name, :string
449
+ t.column :taggings_count, :integer, :default => 0
450
+ end
451
+
452
+ create_table :toys, :primary_key => :toy_id ,:force => true do |t|
453
+ t.string :name
454
+ t.integer :pet_id, :integer
455
+ end
456
+
457
+ create_table :treasures, :force => true do |t|
458
+ t.column :name, :string
459
+ t.column :looter_id, :integer
460
+ t.column :looter_type, :string
461
+ end
462
+
463
+ create_table :vertices, :force => true do |t|
464
+ t.column :label, :string
465
+ end
466
+
467
+ create_table 'warehouse_things', :force => true do |t|
468
+ t.integer :value
469
+ end
470
+
471
+ except 'IBM_DB' do
472
+ [:circles, :squares, :triangles, :non_poly_ones, :non_poly_twos].each do |t|
473
+ create_table(t, :force => true) { }
474
+ end
475
+ end
476
+
477
+ create_table :guids, :force => true do |t|
478
+ t.column :key, :string
479
+ end
480
+
481
+ create_table :integer_limits, :force => true do |t|
482
+ t.integer :"c_int_without_limit"
483
+ (1..8).each do |i|
484
+ t.integer :"c_int_#{i}", :limit => i
485
+ end
486
+ end
487
+
488
+ except ['SQLite','IBM_DB'] do
489
+ # fk_test_has_fk should be before fk_test_has_pk
490
+ create_table :fk_test_has_fk, :force => true do |t|
491
+ t.integer :fk_id, :null => false
492
+ end
493
+
494
+ create_table :fk_test_has_pk, :force => true do |t|
495
+ end
496
+
497
+ 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'})"
498
+ end
499
+ end