ibm_db 2.5.26-universal-darwin-14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGES +233 -0
  3. data/LICENSE +18 -0
  4. data/MANIFEST +14 -0
  5. data/ParameterizedQueries README +39 -0
  6. data/README +225 -0
  7. data/ext/Makefile.nt32 +181 -0
  8. data/ext/Makefile.nt32.191 +212 -0
  9. data/ext/extconf.rb +261 -0
  10. data/ext/ibm_db.c +11793 -0
  11. data/ext/ruby_ibm_db.h +240 -0
  12. data/ext/ruby_ibm_db_cli.c +845 -0
  13. data/ext/ruby_ibm_db_cli.h +489 -0
  14. data/init.rb +42 -0
  15. data/lib/IBM_DB.rb +19 -0
  16. data/lib/active_record/connection_adapters/ibm_db_adapter.rb +3289 -0
  17. data/lib/active_record/connection_adapters/ibm_db_pstmt.rb +1965 -0
  18. data/lib/active_record/connection_adapters/ibmdb_adapter.rb +2 -0
  19. data/lib/active_record/vendor/db2-i5-zOS.yaml +328 -0
  20. data/lib/linux/rb18x/ibm_db.bundle +0 -0
  21. data/lib/linux/rb19x/ibm_db.bundle +0 -0
  22. data/lib/linux/rb20x/ibm_db.bundle +0 -0
  23. data/lib/linux/rb21x/ibm_db.bundle +0 -0
  24. data/test/cases/adapter_test.rb +207 -0
  25. data/test/cases/associations/belongs_to_associations_test.rb +711 -0
  26. data/test/cases/associations/cascaded_eager_loading_test.rb +181 -0
  27. data/test/cases/associations/has_and_belongs_to_many_associations_test.rb +851 -0
  28. data/test/cases/associations/join_model_test.rb +743 -0
  29. data/test/cases/attribute_methods_test.rb +822 -0
  30. data/test/cases/base_test.rb +2133 -0
  31. data/test/cases/calculations_test.rb +482 -0
  32. data/test/cases/migration_test.rb +2408 -0
  33. data/test/cases/persistence_test.rb +642 -0
  34. data/test/cases/query_cache_test.rb +257 -0
  35. data/test/cases/relations_test.rb +1182 -0
  36. data/test/cases/schema_dumper_test.rb +256 -0
  37. data/test/cases/transaction_callbacks_test.rb +300 -0
  38. data/test/cases/validations/uniqueness_validation_test.rb +299 -0
  39. data/test/cases/xml_serialization_test.rb +408 -0
  40. data/test/config.yml +154 -0
  41. data/test/connections/native_ibm_db/connection.rb +44 -0
  42. data/test/ibm_db_test.rb +25 -0
  43. data/test/models/warehouse_thing.rb +5 -0
  44. data/test/schema/i5/ibm_db_specific_schema.rb +137 -0
  45. data/test/schema/ids/ibm_db_specific_schema.rb +140 -0
  46. data/test/schema/luw/ibm_db_specific_schema.rb +137 -0
  47. data/test/schema/schema.rb +751 -0
  48. data/test/schema/zOS/ibm_db_specific_schema.rb +208 -0
  49. metadata +114 -0
data/test/config.yml ADDED
@@ -0,0 +1,154 @@
1
+ default_connection: <%= defined?(JRUBY_VERSION) ? 'jdbcsqlite3' : 'sqlite3' %>
2
+
3
+ connections:
4
+ jdbcderby:
5
+ arunit: activerecord_unittest
6
+ arunit2: activerecord_unittest2
7
+
8
+ jdbch2:
9
+ arunit: activerecord_unittest
10
+ arunit2: activerecord_unittest2
11
+
12
+ jdbchsqldb:
13
+ arunit: activerecord_unittest
14
+ arunit2: activerecord_unittest2
15
+
16
+ jdbcmysql:
17
+ arunit:
18
+ username: rails
19
+ encoding: utf8
20
+ arunit2:
21
+ username: rails
22
+ encoding: utf8
23
+
24
+ jdbcpostgresql:
25
+ arunit:
26
+ username: <%= ENV['user'] || 'rails' %>
27
+ arunit2:
28
+ username: <%= ENV['user'] || 'rails' %>
29
+
30
+ jdbcsqlite3:
31
+ arunit:
32
+ database: <%= FIXTURES_ROOT %>/fixture_database.sqlite3
33
+ timeout: 5000
34
+ arunit2:
35
+ database: <%= FIXTURES_ROOT %>/fixture_database_2.sqlite3
36
+ timeout: 5000
37
+
38
+ db2:
39
+ arunit:
40
+ host: localhost
41
+ username: arunit
42
+ password: arunit
43
+ database: arunit
44
+ arunit2:
45
+ host: localhost
46
+ username: arunit
47
+ password: arunit
48
+ database: arunit2
49
+
50
+ ibm_db:
51
+ arunit:
52
+ username: db2user
53
+ password: secret
54
+ database: railsdb
55
+ start_id: 1000
56
+ arunit2:
57
+ username: db2user
58
+ password: secret
59
+ database: railsdb
60
+ start_id: 1000
61
+
62
+ firebird:
63
+ arunit:
64
+ host: localhost
65
+ username: rails
66
+ password: rails
67
+ charset: UTF8
68
+ arunit2:
69
+ host: localhost
70
+ username: rails
71
+ password: rails
72
+ charset: UTF8
73
+
74
+ frontbase:
75
+ arunit:
76
+ host: localhost
77
+ username: rails
78
+ session_name: unittest-<%= $$ %>
79
+ arunit2:
80
+ host: localhost
81
+ username: rails
82
+ session_name: unittest-<%= $$ %>
83
+
84
+ mysql:
85
+ arunit:
86
+ username: root
87
+ password: root123
88
+ port: 3306
89
+ database: railsdb
90
+ encoding: utf8
91
+ arunit2:
92
+ username: root
93
+ password: root123
94
+ port: 3306
95
+ database: railsdb
96
+ encoding: utf8
97
+
98
+ mysql2:
99
+ arunit:
100
+ username: rails
101
+ encoding: utf8
102
+ arunit2:
103
+ username: rails
104
+ encoding: utf8
105
+
106
+ openbase:
107
+ arunit:
108
+ username: admin
109
+ arunit2:
110
+ username: admin
111
+
112
+ oracle:
113
+ arunit:
114
+ adapter: oracle_enhanced
115
+ database: <%= ENV['ARUNIT_DB_NAME'] || 'orcl' %>
116
+ username: <%= ENV['ARUNIT_USER_NAME'] || 'arunit' %>
117
+ password: <%= ENV['ARUNIT_PASSWORD'] || 'arunit' %>
118
+ emulate_oracle_adapter: true
119
+ arunit2:
120
+ adapter: oracle_enhanced
121
+ database: <%= ENV['ARUNIT_DB_NAME'] || 'orcl' %>
122
+ username: <%= ENV['ARUNIT2_USER_NAME'] || 'arunit2' %>
123
+ password: <%= ENV['ARUNIT2_PASSWORD'] || 'arunit2' %>
124
+ emulate_oracle_adapter: true
125
+
126
+ postgresql:
127
+ arunit:
128
+ min_messages: warning
129
+ arunit2:
130
+ min_messages: warning
131
+
132
+ sqlite3:
133
+ arunit:
134
+ database: <%= FIXTURES_ROOT %>/fixture_database.sqlite3
135
+ timeout: 5000
136
+ arunit2:
137
+ database: <%= FIXTURES_ROOT %>/fixture_database_2.sqlite3
138
+ timeout: 5000
139
+
140
+ sqlite3_mem:
141
+ arunit:
142
+ adapter: sqlite3
143
+ database: ':memory:'
144
+ arunit2:
145
+ adapter: sqlite3
146
+ database: ':memory:'
147
+
148
+ sybase:
149
+ arunit:
150
+ host: database_ASE
151
+ username: sa
152
+ arunit2:
153
+ host: database_ASE
154
+ username: sa
@@ -0,0 +1,44 @@
1
+ =begin
2
+ print "Using native IBM_DB\n"
3
+ require_dependency 'models/course'
4
+ require 'logger'
5
+
6
+ ActiveRecord::Base.logger = Logger.new STDOUT
7
+ ActiveRecord::Base.logger.level = Logger::FATAL
8
+
9
+ ActiveRecord::Base.configurations = {
10
+ 'arunit' => {
11
+ :adapter => 'ibm_db',
12
+ :username => 'db2user',
13
+ :password => 'secret',
14
+ :host => 'bilbao',
15
+ :port => '50000',
16
+ :schema => 'rails123',
17
+ :account => 'tester',
18
+ :app_user => 'tester_11',
19
+ :application => 'rails_tests',
20
+ :workstation => 'auckland',
21
+ :start_id => 100,
22
+ :database => 'ARUNIT',
23
+ :parameterized => false
24
+ },
25
+ 'arunit2' => {
26
+ :adapter => 'ibm_db',
27
+ :username => 'db2user',
28
+ :password => 'secret',
29
+ :host => 'bilbao',
30
+ :port => '50000',
31
+ :schema => 'rails123',
32
+ :account => 'tester',
33
+ :app_user => 'tester_11',
34
+ :application => 'rails_tests',
35
+ :workstation => 'auckland',
36
+ :start_id => 100,
37
+ :database => 'ARUNIT2',
38
+ :parameterized => false
39
+ }
40
+ }
41
+
42
+ ActiveRecord::Base.establish_connection 'arunit'
43
+ Course.establish_connection 'arunit2'
44
+ =end
@@ -0,0 +1,25 @@
1
+ require 'test/unit'
2
+
3
+ class IBM_DBAdapterTest < Test::Unit::TestCase
4
+ require 'pathname'
5
+
6
+ # Fixture
7
+ def driver_lib_path
8
+ drv_path = Pathname.new(File.dirname(__FILE__)).parent + 'lib'
9
+ drv_path += (RUBY_PLATFORM =~ /mswin32/) ? 'mswin32' : 'linux32'
10
+ drv_path += 'ibm_db.so'
11
+ end
12
+
13
+ # Check IBM_DB Ruby driver for this platform: #{RUBY_PLATFORM}
14
+ def test_driver_existence
15
+ driver = driver_lib_path
16
+ assert driver.file?
17
+ end
18
+
19
+ # Attempt loading IBM_DB Ruby driver for this platform: #{RUBY_PLATFORM}
20
+ def test_driver_loading
21
+ driver = driver_lib_path
22
+ require "#{driver.to_s}"
23
+ assert true
24
+ end
25
+ end
@@ -0,0 +1,5 @@
1
+ class WarehouseThing < ActiveRecord::Base
2
+ set_table_name "warehouse_things"
3
+
4
+ validates_uniqueness_of :value
5
+ end
@@ -0,0 +1,137 @@
1
+ =begin
2
+ ActiveRecord::Schema.define do
3
+
4
+ execute "DROP TABLE COMMENTS" rescue nil
5
+ execute "DROP TABLE POSTS" rescue nil
6
+ execute "DROP TABLE ITEMS" rescue nil
7
+ execute "DROP TABLE TOPICS" rescue nil
8
+ execute "DROP TABLE fk_test_has_fk" rescue nil
9
+ execute "DROP TABLE fk_test_has_pk" rescue nil
10
+ execute "DROP TABLE CIRCLES" rescue nil
11
+ execute "DROP TABLE SQUARES" rescue nil
12
+ execute "DROP TABLE TRIANGLES" rescue nil
13
+ execute "DROP TABLE NON_POLY_ONES" rescue nil
14
+ execute "DROP TABLE NON_POLY_TWOS" rescue nil
15
+ execute "DROP TABLE PAINT_COLORS" rescue nil
16
+ execute "DROP TABLE PAINT_TEXTURES" rescue nil
17
+
18
+ execute <<_SQL
19
+ CREATE TABLE comments (
20
+ id INT GENERATED BY DEFAULT AS IDENTITY (START WITH 100),
21
+ post_id INT NOT NULL,
22
+ type VARCHAR(255) DEFAULT NULL,
23
+ body VARCHAR(3000)NOT NULL,
24
+ PRIMARY KEY (id)
25
+ );
26
+ _SQL
27
+
28
+ execute <<_SQL
29
+ CREATE TABLE posts (
30
+ id INT GENERATED BY DEFAULT AS IDENTITY (START WITH 100),
31
+ author_id INT DEFAULT NULL,
32
+ title VARCHAR(255) NOT NULL,
33
+ type VARCHAR(255) DEFAULT NULL,
34
+ body VARCHAR(3000) NOT NULL,
35
+ comments_count integer DEFAULT 0,
36
+ taggings_count integer DEFAULT 0,
37
+ PRIMARY KEY (id)
38
+ );
39
+ _SQL
40
+
41
+ execute <<_SQL
42
+ CREATE TABLE fk_test_has_pk (
43
+ id INT GENERATED BY DEFAULT AS IDENTITY (START WITH 100),
44
+ PRIMARY KEY (id)
45
+ );
46
+ _SQL
47
+
48
+ execute <<_SQL
49
+ CREATE TABLE fk_test_has_fk (
50
+ id INT GENERATED BY DEFAULT AS IDENTITY (START WITH 100),
51
+ fk_id integer NOT NULL,
52
+ PRIMARY KEY (id),
53
+ FOREIGN KEY (fk_id) REFERENCES fk_test_has_pk(id)
54
+ );
55
+ _SQL
56
+
57
+ execute <<_SQL
58
+ CREATE TABLE items (
59
+ id INT GENERATED BY DEFAULT AS IDENTITY (START WITH 100),
60
+ name VARCHAR(255) DEFAULT NULL,
61
+ PRIMARY KEY (id)
62
+ );
63
+ _SQL
64
+
65
+ execute <<_SQL
66
+ CREATE TABLE circles (
67
+ id INT GENERATED BY DEFAULT AS IDENTITY (START WITH 1),
68
+ PRIMARY KEY (id)
69
+ );
70
+ _SQL
71
+
72
+ execute <<_SQL
73
+ CREATE TABLE squares(
74
+ id INT GENERATED BY DEFAULT AS IDENTITY (START WITH 1),
75
+ PRIMARY KEY (id)
76
+ );
77
+ _SQL
78
+
79
+ execute <<_SQL
80
+ CREATE TABLE triangles(
81
+ id INT GENERATED BY DEFAULT AS IDENTITY (START WITH 1),
82
+ PRIMARY KEY (id)
83
+ );
84
+ _SQL
85
+
86
+ execute <<_SQL
87
+ CREATE TABLE non_poly_ones(
88
+ id INT GENERATED BY DEFAULT AS IDENTITY (START WITH 1),
89
+ PRIMARY KEY (id)
90
+ );
91
+ _SQL
92
+
93
+ execute <<_SQL
94
+ CREATE TABLE non_poly_twos(
95
+ id INT GENERATED BY DEFAULT AS IDENTITY (START WITH 1),
96
+ PRIMARY KEY (id)
97
+ );
98
+ _SQL
99
+
100
+ execute <<_SQL
101
+ CREATE TABLE paint_colors(
102
+ id INT GENERATED BY DEFAULT AS IDENTITY (START WITH 1),
103
+ non_poly_one_id INT,
104
+ PRIMARY KEY (id)
105
+ );
106
+ _SQL
107
+
108
+ execute <<_SQL
109
+ CREATE TABLE paint_textures(
110
+ id INT GENERATED BY DEFAULT AS IDENTITY (START WITH 1),
111
+ non_poly_two_id INT,
112
+ PRIMARY KEY (id)
113
+ );
114
+ _SQL
115
+
116
+ execute <<_SQL
117
+ CREATE TABLE topics (
118
+ id INT GENERATED BY DEFAULT AS IDENTITY (START WITH 100),
119
+ title VARCHAR(255) DEFAULT NULL,
120
+ author_name VARCHAR(255) DEFAULT NULL,
121
+ author_email_address VARCHAR(255) DEFAULT NULL,
122
+ written_on TIMESTAMP DEFAULT NULL,
123
+ bonus_time TIME DEFAULT NULL,
124
+ last_read DATE DEFAULT NULL,
125
+ content VARCHAR(3000),
126
+ approved SMALLINT DEFAULT 1,
127
+ replies_count INT DEFAULT 0,
128
+ parent_id INT DEFAULT NULL,
129
+ parent_title VARCHAR(255) DEFAULT NULL,
130
+ group VARCHAR(255) DEFAULT NULL,
131
+ type VARCHAR(255) DEFAULT NULL,
132
+ PRIMARY KEY (id)
133
+ );
134
+ _SQL
135
+
136
+ end
137
+ =end
@@ -0,0 +1,140 @@
1
+ =begin
2
+ ActiveRecord::Schema.define do
3
+
4
+ execute "DROP TABLE COMMENTS" rescue nil
5
+ execute "DROP TABLE POSTS" rescue nil
6
+ execute "DROP TABLE ITEMS" rescue nil
7
+ execute "DROP TABLE TOPICS" rescue nil
8
+ execute "DROP TABLE fk_test_has_fk" rescue nil
9
+ execute "DROP TABLE fk_test_has_pk" rescue nil
10
+ execute "DROP TABLE CIRCLES" rescue nil
11
+ execute "DROP TABLE SQUARES" rescue nil
12
+ execute "DROP TABLE TRIANGLES" rescue nil
13
+ execute "DROP TABLE NON_POLY_ONES" rescue nil
14
+ execute "DROP TABLE NON_POLY_TWOS" rescue nil
15
+ execute "DROP TABLE PAINT_COLORS" rescue nil
16
+ execute "DROP TABLE PAINT_TEXTURES" rescue nil
17
+
18
+ execute <<_SQL
19
+ CREATE TABLE comments (
20
+ id SERIAL(100),
21
+ post_id INT DEFAULT NULL,
22
+ type VARCHAR(255) DEFAULT NULL,
23
+ body LVARCHAR(3000) DEFAULT NULL
24
+ );
25
+ _SQL
26
+
27
+ execute <<_SQL
28
+ CREATE TABLE posts (
29
+ id SERIAL(100),
30
+ author_id INT DEFAULT NULL,
31
+ title VARCHAR(255) DEFAULT NULL,
32
+ type VARCHAR(255) DEFAULT NULL,
33
+ body LVARCHAR(3000) DEFAULT NULL,
34
+ comments_count INT DEFAULT 0,
35
+ taggings_count INT DEFAULT 0,
36
+ PRIMARY KEY (id)
37
+ );
38
+
39
+ _SQL
40
+
41
+ execute <<_SQL
42
+ CREATE TABLE items (
43
+ id SERIAL(100),
44
+ name VARCHAR(255) DEFAULT NULL,
45
+ PRIMARY KEY (id)
46
+ );
47
+
48
+ _SQL
49
+
50
+ execute <<_SQL
51
+ CREATE TABLE circles (
52
+ id SERIAL(100),
53
+ PRIMARY KEY (id)
54
+ );
55
+ _SQL
56
+
57
+ execute <<_SQL
58
+ CREATE TABLE squares(
59
+ id SERIAL(100),
60
+ PRIMARY KEY (id)
61
+ );
62
+ _SQL
63
+
64
+ execute <<_SQL
65
+ CREATE TABLE triangles(
66
+ id SERIAL(100),
67
+ PRIMARY KEY (id)
68
+ );
69
+ _SQL
70
+
71
+ execute <<_SQL
72
+ CREATE TABLE non_poly_ones(
73
+ id SERIAL(100),
74
+ PRIMARY KEY (id)
75
+ );
76
+ _SQL
77
+
78
+ execute <<_SQL
79
+ CREATE TABLE non_poly_twos(
80
+ id SERIAL(100),
81
+ PRIMARY KEY (id)
82
+ );
83
+ _SQL
84
+
85
+ execute <<_SQL
86
+ CREATE TABLE paint_colors(
87
+ id SERIAL(100),
88
+ non_poly_one_id INT,
89
+ PRIMARY KEY (id)
90
+ );
91
+ _SQL
92
+
93
+ execute <<_SQL
94
+ CREATE TABLE paint_textures(
95
+ id SERIAL(100),
96
+ non_poly_two_id INT,
97
+ PRIMARY KEY (id)
98
+ );
99
+ _SQL
100
+
101
+ execute <<_SQL
102
+ CREATE TABLE topics (
103
+ id SERIAL(100),
104
+ title VARCHAR(255) DEFAULT NULL,
105
+ author_name VARCHAR(255) DEFAULT NULL,
106
+ author_email_address VARCHAR(255) DEFAULT NULL,
107
+ written_on DATETIME YEAR TO FRACTION(5) DEFAULT NULL,
108
+ bonus_time DATETIME YEAR TO FRACTION(5) DEFAULT NULL,
109
+ --bonus_time DATETIME HOUR TO SECOND DEFAULT NULL,
110
+ last_read DATE DEFAULT NULL,
111
+ content LVARCHAR(3000),
112
+ approved SMALLINT DEFAULT 1,
113
+ replies_count INT DEFAULT 0,
114
+ parent_id INT DEFAULT NULL,
115
+ parent_title VARCHAR(255) DEFAULT NULL,
116
+ group VARCHAR(255) DEFAULT NULL,
117
+ type VARCHAR(50) DEFAULT NULL,
118
+ PRIMARY KEY (id)
119
+ );
120
+
121
+ _SQL
122
+
123
+ execute <<_SQL
124
+ CREATE TABLE fk_test_has_pk (
125
+ id INT NOT NULL PRIMARY KEY
126
+ );
127
+
128
+ _SQL
129
+
130
+ execute <<_SQL
131
+ CREATE TABLE fk_test_has_fk (
132
+ id INT NOT NULL PRIMARY KEY,
133
+ fk_id INT NOT NULL,
134
+ FOREIGN KEY (fk_id) REFERENCES fk_test_has_pk(id)
135
+ );
136
+
137
+ _SQL
138
+
139
+ end
140
+ =end