ibm_db 4.0.0 → 5.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README +2 -2
- data/ext/Makefile +266 -0
- data/ext/extconf.rb +34 -3
- data/ext/gil_release_version +3 -0
- data/ext/ibm_db.c +100 -108
- data/ext/mkmf.log +103 -0
- data/ext/unicode_support_version +3 -0
- data/lib/active_record/connection_adapters/ibm_db_adapter.rb +256 -175
- data/test/cases/attribute_decorators_test.rb +2 -1
- data/test/cases/cache_key_test.rb +2 -1
- data/test/cases/comment_test.rb +4 -2
- data/test/cases/date_time_precision_test.rb +2 -1
- data/test/cases/defaults_test.rb +2 -1
- data/test/cases/migration/foreign_key_test.rb +4 -2
- data/test/cases/migration/helper.rb +1 -1
- data/test/cases/migration/references_foreign_key_test.rb +10 -5
- data/test/cases/migrator_test.rb +2 -1
- data/test/cases/schema_dumper_test.rb +3 -3
- data/test/cases/time_precision_test.rb +2 -1
- data/test/cases/transactions_test.rb +3 -2
- data/test/config.yml +154 -154
- data/test/connections/native_ibm_db/connection.rb +44 -0
- data/test/fixtures/admin/randomly_named_a9.yml +7 -7
- data/test/fixtures/admin/randomly_named_b0.yml +7 -7
- data/test/fixtures/developers.yml +1 -1
- data/test/fixtures/pirates.yml +0 -3
- data/test/fixtures/randomly_named_a9.yml +7 -7
- data/test/ibm_db_test.rb +24 -24
- data/test/models/admin.rb +1 -1
- data/test/models/admin/account.rb +1 -1
- data/test/models/admin/randomly_named_c1.rb +7 -7
- data/test/models/binary.rb +1 -1
- data/test/models/event.rb +1 -1
- data/test/models/guid.rb +1 -1
- data/test/models/randomly_named_c1.rb +3 -3
- data/test/models/ship_part.rb +1 -1
- data/test/schema/i5/ibm_db_specific_schema.rb +137 -0
- data/test/schema/ids/ibm_db_specific_schema.rb +140 -0
- data/test/schema/luw/ibm_db_specific_schema.rb +137 -0
- data/test/schema/zOS/ibm_db_specific_schema.rb +208 -0
- metadata +24 -13
- data/test/fixtures/author_addresses.original +0 -11
- data/test/fixtures/authors.original +0 -17
@@ -28,7 +28,8 @@ module ActiveRecord
|
|
28
28
|
|
29
29
|
teardown do
|
30
30
|
return unless @connection
|
31
|
-
@connection.drop_table 'attribute_decorators_model'
|
31
|
+
@connection.drop_table 'attribute_decorators_model'
|
32
|
+
#, if_exists: true
|
32
33
|
Model.attribute_type_decorations.clear
|
33
34
|
Model.reset_column_information
|
34
35
|
end
|
data/test/cases/comment_test.rb
CHANGED
@@ -39,8 +39,10 @@ class CommentTest < ActiveRecord::TestCase
|
|
39
39
|
end
|
40
40
|
|
41
41
|
teardown do
|
42
|
-
@connection.drop_table 'commenteds'
|
43
|
-
|
42
|
+
@connection.drop_table 'commenteds'
|
43
|
+
#, if_exists: true
|
44
|
+
@connection.drop_table 'blank_comments'
|
45
|
+
#, if_exists: true
|
44
46
|
end
|
45
47
|
|
46
48
|
def test_column_created_in_block
|
data/test/cases/defaults_test.rb
CHANGED
@@ -30,8 +30,10 @@ module ActiveRecord
|
|
30
30
|
|
31
31
|
teardown do
|
32
32
|
if defined?(@connection)
|
33
|
-
@connection.drop_table "astronauts"
|
34
|
-
|
33
|
+
@connection.drop_table "astronauts"
|
34
|
+
#, if_exists: true
|
35
|
+
@connection.drop_table "rockets"
|
36
|
+
#, if_exists: true
|
35
37
|
end
|
36
38
|
end
|
37
39
|
|
@@ -10,8 +10,10 @@ module ActiveRecord
|
|
10
10
|
end
|
11
11
|
|
12
12
|
teardown do
|
13
|
-
@connection.drop_table "testings"
|
14
|
-
|
13
|
+
@connection.drop_table "testings"
|
14
|
+
#, if_exists: true
|
15
|
+
@connection.drop_table "testing_parents"
|
16
|
+
#, if_exists: true
|
15
17
|
end
|
16
18
|
|
17
19
|
test "foreign keys can be created with the table" do
|
@@ -141,7 +143,8 @@ module ActiveRecord
|
|
141
143
|
end
|
142
144
|
ensure
|
143
145
|
ActiveRecord::Base.pluralize_table_names = original_pluralize_table_names
|
144
|
-
@connection.drop_table "testing"
|
146
|
+
@connection.drop_table "testing"
|
147
|
+
#, if_exists: true
|
145
148
|
end
|
146
149
|
end
|
147
150
|
|
@@ -201,8 +204,10 @@ class ReferencesWithoutForeignKeySupportTest < ActiveRecord::TestCase
|
|
201
204
|
end
|
202
205
|
|
203
206
|
teardown do
|
204
|
-
@connection.drop_table("testings"
|
205
|
-
|
207
|
+
@connection.drop_table("testings")
|
208
|
+
#, if_exists: true)
|
209
|
+
@connection.drop_table("testing_parents")
|
210
|
+
#, if_exists: true)
|
206
211
|
end
|
207
212
|
|
208
213
|
test "ignores foreign keys defined with the table" do
|
data/test/cases/migrator_test.rb
CHANGED
@@ -394,7 +394,8 @@ class MigratorTest < ActiveRecord::TestCase
|
|
394
394
|
def test_migrator_db_has_no_schema_migrations_table
|
395
395
|
_, migrator = migrator_class(3)
|
396
396
|
|
397
|
-
ActiveRecord::Base.connection.drop_table "schema_migrations"
|
397
|
+
ActiveRecord::Base.connection.drop_table "schema_migrations"
|
398
|
+
#, if_exists: true
|
398
399
|
ActiveSupport::Deprecation.silence { assert_not ActiveRecord::Base.connection.table_exists?('schema_migrations') }
|
399
400
|
migrator.migrate("valid", 1)
|
400
401
|
ActiveSupport::Deprecation.silence { assert ActiveRecord::Base.connection.table_exists?('schema_migrations') }
|
@@ -318,8 +318,7 @@ class SchemaDumperTest < ActiveRecord::TestCase
|
|
318
318
|
assert_match %r{t\.integer\s+"atoms_in_universe",\s+precision: 38}, output
|
319
319
|
elsif current_adapter?(:IBM_DBAdapter)
|
320
320
|
# DB2 supports precision up to 31
|
321
|
-
assert_match %r{t.decimal\s+"atoms_in_universe",\s+precision: 31,\s+scale: 0}, output
|
322
|
-
else
|
321
|
+
assert_match %r{t.decimal\s+"atoms_in_universe",\s+precision: 31,\s+scale: 0}, output
|
323
322
|
elsif current_adapter?(:FbAdapter)
|
324
323
|
assert_match %r{t\.integer\s+"atoms_in_universe",\s+precision: 18}, output
|
325
324
|
else
|
@@ -443,7 +442,8 @@ class SchemaDumperDefaultsTest < ActiveRecord::TestCase
|
|
443
442
|
|
444
443
|
teardown do
|
445
444
|
return unless @connection
|
446
|
-
@connection.drop_table 'defaults'
|
445
|
+
@connection.drop_table 'defaults'
|
446
|
+
#, if_exists: true
|
447
447
|
end
|
448
448
|
|
449
449
|
def test_schema_dump_defaults_with_universally_supported_types
|
@@ -10,7 +10,7 @@ require 'models/movie'
|
|
10
10
|
|
11
11
|
class TransactionTest < ActiveRecord::TestCase
|
12
12
|
self.use_transactional_tests = false
|
13
|
-
fixtures :topics, :developers, :authors, :posts
|
13
|
+
fixtures :topics, :developers, :authors, :posts, :author_addresses
|
14
14
|
|
15
15
|
def setup
|
16
16
|
@first, @second = Topic.find(1, 2).sort_by(&:id)
|
@@ -703,7 +703,8 @@ class TransactionTest < ActiveRecord::TestCase
|
|
703
703
|
end
|
704
704
|
end
|
705
705
|
ensure
|
706
|
-
connection.drop_table 'transaction_without_primary_keys'
|
706
|
+
connection.drop_table 'transaction_without_primary_keys'
|
707
|
+
#, if_exists: true
|
707
708
|
end
|
708
709
|
|
709
710
|
private
|
data/test/config.yml
CHANGED
@@ -1,154 +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
|
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
|