activerecord-jdbc-adapter 1.2.9.1 → 1.3.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +3 -0
- data/Appraisals +12 -4
- data/Gemfile +3 -3
- data/Gemfile.lock +19 -19
- data/History.txt +90 -16
- data/LICENSE.txt +2 -1
- data/README.md +14 -1
- data/activerecord-jdbc-adapter.gemspec +2 -2
- data/gemfiles/rails23.gemfile +5 -5
- data/gemfiles/rails23.gemfile.lock +27 -27
- data/gemfiles/rails30.gemfile +3 -3
- data/gemfiles/rails30.gemfile.lock +8 -8
- data/gemfiles/rails31.gemfile +4 -4
- data/gemfiles/rails31.gemfile.lock +18 -18
- data/gemfiles/rails32.gemfile +4 -4
- data/gemfiles/rails32.gemfile.lock +17 -17
- data/gemfiles/rails40.gemfile +17 -0
- data/gemfiles/rails40.gemfile.lock +126 -0
- data/lib/activerecord-jdbc-adapter.rb +0 -7
- data/lib/arjdbc.rb +6 -5
- data/lib/arjdbc/db2.rb +1 -1
- data/lib/arjdbc/db2/adapter.rb +52 -29
- data/lib/arjdbc/db2/connection_methods.rb +13 -14
- data/lib/arjdbc/derby.rb +1 -1
- data/lib/arjdbc/derby/adapter.rb +29 -9
- data/lib/arjdbc/derby/connection_methods.rb +17 -20
- data/lib/arjdbc/firebird.rb +1 -1
- data/lib/arjdbc/h2.rb +2 -2
- data/lib/arjdbc/h2/adapter.rb +1 -1
- data/lib/arjdbc/h2/connection_methods.rb +12 -16
- data/lib/arjdbc/hsqldb.rb +1 -1
- data/lib/arjdbc/hsqldb/connection_methods.rb +13 -16
- data/lib/arjdbc/informix.rb +1 -1
- data/lib/arjdbc/informix/connection_methods.rb +8 -10
- data/lib/arjdbc/jdbc.rb +1 -1
- data/lib/arjdbc/jdbc/adapter.rb +125 -53
- data/lib/arjdbc/jdbc/adapter_java.jar +0 -0
- data/lib/arjdbc/jdbc/base_ext.rb +34 -9
- data/lib/arjdbc/jdbc/column.rb +15 -2
- data/lib/arjdbc/jdbc/connection.rb +0 -2
- data/lib/arjdbc/jdbc/connection_methods.rb +10 -3
- data/lib/arjdbc/jdbc/driver.rb +2 -2
- data/lib/arjdbc/jdbc/extension.rb +35 -21
- data/lib/arjdbc/jdbc/java.rb +0 -2
- data/lib/arjdbc/jdbc/missing_functionality_helper.rb +35 -25
- data/lib/arjdbc/jdbc/railtie.rb +2 -9
- data/lib/arjdbc/mimer.rb +1 -1
- data/lib/arjdbc/mssql.rb +2 -2
- data/lib/arjdbc/mssql/adapter.rb +271 -92
- data/lib/arjdbc/mssql/connection_methods.rb +30 -32
- data/lib/arjdbc/mssql/explain_support.rb +107 -0
- data/lib/arjdbc/mssql/limit_helpers.rb +48 -18
- data/lib/arjdbc/mysql.rb +1 -1
- data/lib/arjdbc/mysql/adapter.rb +63 -14
- data/lib/arjdbc/mysql/connection_methods.rb +22 -24
- data/lib/arjdbc/mysql/explain_support.rb +2 -5
- data/lib/arjdbc/oracle.rb +1 -1
- data/lib/arjdbc/oracle/adapter.rb +78 -38
- data/lib/arjdbc/oracle/connection_methods.rb +9 -10
- data/lib/arjdbc/postgresql.rb +1 -1
- data/lib/arjdbc/postgresql/adapter.rb +964 -380
- data/lib/arjdbc/postgresql/column_cast.rb +136 -0
- data/lib/arjdbc/postgresql/connection_methods.rb +19 -21
- data/lib/arjdbc/postgresql/explain_support.rb +3 -6
- data/lib/arjdbc/railtie.rb +9 -0
- data/lib/arjdbc/sqlite3.rb +1 -1
- data/lib/arjdbc/sqlite3/adapter.rb +73 -26
- data/lib/arjdbc/sqlite3/connection_methods.rb +27 -28
- data/lib/arjdbc/sqlite3/explain_support.rb +2 -5
- data/lib/arjdbc/sybase.rb +1 -1
- data/lib/arjdbc/version.rb +5 -4
- data/pom.xml +8 -0
- data/rakelib/02-test.rake +57 -51
- data/rakelib/compile.rake +17 -5
- data/rakelib/rails.rake +42 -31
- data/src/java/arjdbc/db2/DB2RubyJdbcConnection.java +4 -3
- data/src/java/arjdbc/derby/DerbyModule.java +98 -85
- data/src/java/arjdbc/derby/DerbyRubyJdbcConnection.java +70 -0
- data/src/java/arjdbc/h2/H2RubyJdbcConnection.java +0 -4
- data/src/java/arjdbc/jdbc/AdapterJavaService.java +26 -15
- data/src/java/arjdbc/jdbc/Callable.java +44 -0
- data/src/java/arjdbc/jdbc/JdbcConnectionFactory.java +10 -2
- data/src/java/arjdbc/jdbc/RubyJdbcConnection.java +1675 -834
- data/src/java/arjdbc/jdbc/SQLBlock.java +9 -3
- data/src/java/arjdbc/mssql/MSSQLRubyJdbcConnection.java +73 -36
- data/src/java/arjdbc/mysql/MySQLModule.java +11 -10
- data/src/java/arjdbc/mysql/MySQLRubyJdbcConnection.java +86 -80
- data/src/java/arjdbc/oracle/OracleRubyJdbcConnection.java +27 -7
- data/src/java/arjdbc/postgresql/PostgreSQLRubyJdbcConnection.java +214 -0
- data/src/java/arjdbc/postgresql/PostgresqlRubyJdbcConnection.java +25 -67
- data/src/java/arjdbc/sqlite3/SQLite3RubyJdbcConnection.java +52 -49
- data/src/java/arjdbc/util/QuotingUtils.java +6 -6
- data/test/abstract_db_create.rb +11 -11
- data/test/activerecord/connection_adapters/type_conversion_test.rb +18 -12
- data/test/db/db2.rb +1 -1
- data/test/{db2_binary_test.rb → db/db2/binary_test.rb} +0 -0
- data/test/db/db2/has_many_through_test.rb +6 -0
- data/test/{db2_reset_column_information_test.rb → db/db2/reset_column_information_test.rb} +1 -2
- data/test/{db2_serialize_test.rb → db/db2/serialize_test.rb} +0 -0
- data/test/{db2_simple_test.rb → db/db2/simple_test.rb} +1 -8
- data/test/db/db2/test_helper.rb +6 -0
- data/test/{db2_test.rb → db/db2/unit_test.rb} +1 -1
- data/test/db/derby.rb +1 -1
- data/test/{derby_binary_test.rb → db/derby/binary_test.rb} +0 -0
- data/test/{derby_migration_test.rb → db/derby/migration_test.rb} +0 -0
- data/test/{derby_reset_column_information_test.rb → db/derby/reset_column_information_test.rb} +0 -0
- data/test/{derby_row_locking_test.rb → db/derby/row_locking_test.rb} +1 -4
- data/test/db/derby/schema_dump_test.rb +5 -0
- data/test/{derby_serialize_test.rb → db/derby/serialize_test.rb} +0 -0
- data/test/{derby_simple_test.rb → db/derby/simple_test.rb} +23 -38
- data/test/db/derby/test_helper.rb +6 -0
- data/test/db/derby/unit_test.rb +32 -0
- data/test/db/derby/xml_column_test.rb +17 -0
- data/test/db/h2.rb +1 -1
- data/test/{h2_binary_test.rb → db/h2/binary_test.rb} +0 -0
- data/test/{h2_change_column_test.rb → db/h2/change_column_test.rb} +1 -0
- data/test/{h2_schema_dump_test.rb → db/h2/schema_dump_test.rb} +0 -0
- data/test/{h2_serialize_test.rb → db/h2/serialize_test.rb} +0 -0
- data/test/{h2_simple_test.rb → db/h2/simple_test.rb} +3 -1
- data/test/db/hsqldb.rb +1 -1
- data/test/{hsqldb_binary_test.rb → db/hsqldb/binary_test.rb} +0 -0
- data/test/{hsqldb_schema_dump_test.rb → db/hsqldb/schema_dump_test.rb} +0 -0
- data/test/{hsqldb_serialize_test.rb → db/hsqldb/serialize_test.rb} +0 -0
- data/test/{hsqldb_simple_test.rb → db/hsqldb/simple_test.rb} +3 -1
- data/test/db/informix.rb +1 -1
- data/test/db/jdbc.rb +3 -2
- data/test/db/jdbc_derby.rb +1 -1
- data/test/db/jdbc_h2.rb +1 -1
- data/test/db/jdbc_mysql.rb +1 -1
- data/test/db/jdbc_postgres.rb +1 -1
- data/test/db/jndi_config.rb +1 -2
- data/test/db/jndi_pooled_config.rb +2 -3
- data/test/db/mssql.rb +2 -2
- data/test/{mssql_binary_test.rb → db/mssql/binary_test.rb} +0 -0
- data/test/{mssql_db_create_test.rb → db/mssql/db_create_test.rb} +1 -1
- data/test/db/mssql/exec_proc_test.rb +46 -0
- data/test/{mssql_identity_insert_test.rb → db/mssql/identity_insert_test.rb} +0 -0
- data/test/db/mssql/ignore_system_views_test.rb +40 -0
- data/test/{mssql_limit_offset_test.rb → db/mssql/limit_offset_test.rb} +10 -1
- data/test/{mssql_multibyte_test.rb → db/mssql/multibyte_test.rb} +0 -0
- data/test/db/mssql/multiple_connections_test.rb +71 -0
- data/test/{mssql_reset_column_information_test.rb → db/mssql/reset_column_information_test.rb} +0 -0
- data/test/{mssql_row_locking_test.rb → db/mssql/row_locking_test.rb} +0 -0
- data/test/{mssql_serialize_test.rb → db/mssql/serialize_test.rb} +1 -1
- data/test/db/mssql/simple_test.rb +140 -0
- data/test/db/mssql/transaction_test.rb +6 -0
- data/test/db/mssql/types_test.rb +205 -0
- data/test/{mssql_test.rb → db/mssql/unit_test.rb} +2 -2
- data/test/db/mysql.rb +1 -2
- data/test/db/mysql/_rails_test_mysql.32.out +6768 -0
- data/test/{mysql_binary_test.rb → db/mysql/binary_test.rb} +0 -0
- data/test/db/mysql/connection_test.rb +51 -0
- data/test/{mysql_db_create_test.rb → db/mysql/db_create_test.rb} +0 -0
- data/test/{mysql_index_length_test.rb → db/mysql/index_length_test.rb} +0 -0
- data/test/{mysql_multibyte_test.rb → db/mysql/multibyte_test.rb} +0 -0
- data/test/{mysql_nonstandard_primary_key_test.rb → db/mysql/nonstandard_primary_key_test.rb} +0 -0
- data/test/{mysql_reset_column_information_test.rb → db/mysql/reset_column_information_test.rb} +0 -0
- data/test/{mysql_schema_dump_test.rb → db/mysql/schema_dump_test.rb} +9 -1
- data/test/{mysql_serialize_test.rb → db/mysql/serialize_test.rb} +0 -0
- data/test/{mysql_simple_test.rb → db/mysql/simple_test.rb} +16 -8
- data/test/db/mysql/transaction_test.rb +6 -0
- data/test/db/mysql/types_test.rb +30 -0
- data/test/{mysql_test.rb → db/mysql/unit_test.rb} +1 -1
- data/test/db/mysql_config.rb +1 -1
- data/test/db/oracle.rb +1 -1
- data/test/{oracle_binary_test.rb → db/oracle/binary_test.rb} +0 -0
- data/test/{oracle_limit_test.rb → db/oracle/limit_test.rb} +0 -0
- data/test/db/oracle/multibyte_test.rb +22 -0
- data/test/{oracle_reset_column_information_test.rb → db/oracle/reset_column_information_test.rb} +0 -0
- data/test/{oracle_serialize_test.rb → db/oracle/serialize_test.rb} +0 -0
- data/test/{oracle_simple_test.rb → db/oracle/simple_test.rb} +14 -19
- data/test/{oracle_specific_test.rb → db/oracle/specific_test.rb} +62 -16
- data/test/db/oracle/transaction_test.rb +31 -0
- data/test/db/oracle/unit_test.rb +31 -0
- data/test/db/postgres.rb +1 -1
- data/test/db/postgres/_rails_test_postgres.32.out +6777 -0
- data/test/db/postgres/a_custom_primary_key_test.rb +50 -0
- data/test/db/postgres/array_type_test.rb +101 -0
- data/test/{postgres_binary_test.rb → db/postgres/binary_test.rb} +0 -0
- data/test/db/postgres/connection_test.rb +55 -0
- data/test/db/postgres/data_types_test.rb +703 -0
- data/test/{postgres_db_create_test.rb → db/postgres/db_create_test.rb} +1 -1
- data/test/{postgres_drop_db_test.rb → db/postgres/db_drop_test.rb} +2 -0
- data/test/db/postgres/hstore_test.rb +200 -0
- data/test/db/postgres/information_schema_leak_test.rb +30 -0
- data/test/db/postgres/json_test.rb +86 -0
- data/test/db/postgres/ltree_test.rb +50 -0
- data/test/{postgres_mixed_case_test.rb → db/postgres/mixed_case_test.rb} +0 -0
- data/test/db/postgres/native_types_test.rb +128 -0
- data/test/{postgres_reserved_test.rb → db/postgres/reserved_test.rb} +0 -0
- data/test/{postgres_reset_column_information_test.rb → db/postgres/reset_column_information_test.rb} +0 -0
- data/test/{postgres_row_locking_test.rb → db/postgres/row_locking_test.rb} +0 -0
- data/test/{postgres_schema_dump_test.rb → db/postgres/schema_dump_test.rb} +4 -4
- data/test/db/postgres/schema_test.rb +113 -0
- data/test/{postgres_simple_test.rb → db/postgres/simple_test.rb} +48 -8
- data/test/{postgres_table_alias_length_test.rb → db/postgres/table_alias_length_test.rb} +2 -1
- data/test/db/postgres/transaction_test.rb +6 -0
- data/test/{postgres_test.rb → db/postgres/unit_test.rb} +3 -3
- data/test/db/sqlite3.rb +1 -1
- data/test/db/sqlite3/_rails_test_sqlite3.32.out +6502 -0
- data/test/db/sqlite3/has_many_though_test.rb +6 -0
- data/test/{sqlite3_reset_column_information_test.rb → db/sqlite3/reset_column_information_test.rb} +0 -0
- data/test/{sqlite3_schema_dump_test.rb → db/sqlite3/schema_dump_test.rb} +0 -0
- data/test/{sqlite3_serialize_test.rb → db/sqlite3/serialize_test.rb} +0 -0
- data/test/{sqlite3_simple_test.rb → db/sqlite3/simple_test.rb} +63 -63
- data/test/db/sqlite3/transaction_test.rb +32 -0
- data/test/{sqlite3_type_conversion_test.rb → db/sqlite3/type_conversion_test.rb} +0 -0
- data/test/has_many_through.rb +29 -64
- data/test/jdbc/oracle.rb +11 -0
- data/test/jndi_test.rb +16 -4
- data/test/models/auto_id.rb +1 -1
- data/test/models/rights_and_roles.rb +57 -0
- data/test/row_locking.rb +3 -0
- data/test/schema_dump.rb +24 -10
- data/test/simple.rb +359 -104
- data/test/test_helper.rb +4 -2
- data/test/transaction.rb +109 -0
- metadata +119 -86
- data/lib/arjdbc/jdbc/compatibility.rb +0 -51
- data/lib/arjdbc/jdbc/core_ext.rb +0 -24
- data/lib/arjdbc/jdbc/discover.rb +0 -18
- data/test/derby_schema_dump_test.rb +0 -9
- data/test/mssql_ignore_system_views_test.rb +0 -30
- data/test/mssql_legacy_types_test.rb +0 -58
- data/test/mssql_null_test.rb +0 -14
- data/test/mssql_simple_test.rb +0 -51
- data/test/postgres_information_schema_leak_test.rb +0 -28
- data/test/postgres_native_type_mapping_test.rb +0 -93
- data/test/postgres_nonseq_pkey_test.rb +0 -38
- data/test/postgres_schema_search_path_test.rb +0 -48
- data/test/postgres_type_conversion_test.rb +0 -33
data/gemfiles/rails30.gemfile
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
# This file was generated by Appraisal
|
2
2
|
|
3
|
-
source "
|
3
|
+
source "https://rubygems.org"
|
4
4
|
|
5
5
|
gem "jruby-openssl", :platform=>:jruby
|
6
6
|
gem "appraisal"
|
7
7
|
gem "rake", :require=>nil
|
8
|
-
gem "test-unit", :group=>:test
|
8
|
+
gem "test-unit", "2.5.4", :group=>:test
|
9
9
|
gem "test-unit-context", :group=>:test
|
10
|
-
gem "mocha", "
|
10
|
+
gem "mocha", ">= 0.13.0", :require=>nil, :group=>:test
|
11
11
|
gem "simplecov", :require=>nil, :group=>:test
|
12
12
|
gem "bcrypt-ruby", "~> 3.0.0", :require=>nil, :group=>:test
|
13
13
|
gem "activerecord", "~> 3.0.20"
|
@@ -1,5 +1,5 @@
|
|
1
1
|
GEM
|
2
|
-
remote:
|
2
|
+
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
4
|
activemodel (3.0.20)
|
5
5
|
activesupport (= 3.0.20)
|
@@ -16,13 +16,13 @@ GEM
|
|
16
16
|
rake
|
17
17
|
arel (2.0.10)
|
18
18
|
bcrypt-ruby (3.0.1-java)
|
19
|
-
bouncy-castle-java (1.5.
|
19
|
+
bouncy-castle-java (1.5.0147)
|
20
20
|
builder (2.1.2)
|
21
21
|
i18n (0.5.0)
|
22
|
-
jruby-openssl (0.
|
23
|
-
bouncy-castle-java (>= 1.5.
|
22
|
+
jruby-openssl (0.8.4)
|
23
|
+
bouncy-castle-java (>= 1.5.0147)
|
24
24
|
metaclass (0.0.1)
|
25
|
-
mocha (0.
|
25
|
+
mocha (0.13.3)
|
26
26
|
metaclass (~> 0.0.1)
|
27
27
|
multi_json (1.5.0)
|
28
28
|
rake (10.0.3)
|
@@ -30,7 +30,7 @@ GEM
|
|
30
30
|
multi_json (~> 1.0)
|
31
31
|
simplecov-html (~> 0.7.1)
|
32
32
|
simplecov-html (0.7.1)
|
33
|
-
test-unit (2.5.
|
33
|
+
test-unit (2.5.4)
|
34
34
|
test-unit-context (0.3.0)
|
35
35
|
test-unit (>= 2.4.0)
|
36
36
|
tzinfo (0.3.35)
|
@@ -43,8 +43,8 @@ DEPENDENCIES
|
|
43
43
|
appraisal
|
44
44
|
bcrypt-ruby (~> 3.0.0)
|
45
45
|
jruby-openssl
|
46
|
-
mocha (
|
46
|
+
mocha (>= 0.13.0)
|
47
47
|
rake
|
48
48
|
simplecov
|
49
|
-
test-unit
|
49
|
+
test-unit (= 2.5.4)
|
50
50
|
test-unit-context
|
data/gemfiles/rails31.gemfile
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# This file was generated by Appraisal
|
2
2
|
|
3
|
-
source "
|
3
|
+
source "https://rubygems.org"
|
4
4
|
|
5
5
|
gem "jruby-openssl", :platform=>:jruby
|
6
6
|
gem "appraisal"
|
7
7
|
gem "rake", :require=>nil
|
8
|
-
gem "test-unit", :group=>:test
|
8
|
+
gem "test-unit", "2.5.4", :group=>:test
|
9
9
|
gem "test-unit-context", :group=>:test
|
10
|
-
gem "mocha", "
|
10
|
+
gem "mocha", ">= 0.13.0", :require=>nil, :group=>:test
|
11
11
|
gem "simplecov", :require=>nil, :group=>:test
|
12
12
|
gem "bcrypt-ruby", "~> 3.0.0", :require=>nil, :group=>:test
|
13
|
-
gem "activerecord", "~> 3.1.
|
13
|
+
gem "activerecord", "~> 3.1.12"
|
14
14
|
|
@@ -1,29 +1,29 @@
|
|
1
1
|
GEM
|
2
|
-
remote:
|
2
|
+
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
|
-
activemodel (3.1.
|
5
|
-
activesupport (= 3.1.
|
4
|
+
activemodel (3.1.12)
|
5
|
+
activesupport (= 3.1.12)
|
6
6
|
builder (~> 3.0.0)
|
7
7
|
i18n (~> 0.6)
|
8
|
-
activerecord (3.1.
|
9
|
-
activemodel (= 3.1.
|
10
|
-
activesupport (= 3.1.
|
8
|
+
activerecord (3.1.12)
|
9
|
+
activemodel (= 3.1.12)
|
10
|
+
activesupport (= 3.1.12)
|
11
11
|
arel (~> 2.2.3)
|
12
12
|
tzinfo (~> 0.3.29)
|
13
|
-
activesupport (3.1.
|
14
|
-
multi_json (
|
13
|
+
activesupport (3.1.12)
|
14
|
+
multi_json (~> 1.0)
|
15
15
|
appraisal (0.5.1)
|
16
16
|
bundler
|
17
17
|
rake
|
18
18
|
arel (2.2.3)
|
19
19
|
bcrypt-ruby (3.0.1-java)
|
20
|
-
bouncy-castle-java (1.5.
|
20
|
+
bouncy-castle-java (1.5.0147)
|
21
21
|
builder (3.0.4)
|
22
|
-
i18n (0.6.
|
23
|
-
jruby-openssl (0.
|
24
|
-
bouncy-castle-java (>= 1.5.
|
22
|
+
i18n (0.6.4)
|
23
|
+
jruby-openssl (0.8.4)
|
24
|
+
bouncy-castle-java (>= 1.5.0147)
|
25
25
|
metaclass (0.0.1)
|
26
|
-
mocha (0.
|
26
|
+
mocha (0.13.3)
|
27
27
|
metaclass (~> 0.0.1)
|
28
28
|
multi_json (1.2.0)
|
29
29
|
rake (10.0.3)
|
@@ -31,21 +31,21 @@ GEM
|
|
31
31
|
multi_json (~> 1.0)
|
32
32
|
simplecov-html (~> 0.7.1)
|
33
33
|
simplecov-html (0.7.1)
|
34
|
-
test-unit (2.5.
|
34
|
+
test-unit (2.5.4)
|
35
35
|
test-unit-context (0.3.0)
|
36
36
|
test-unit (>= 2.4.0)
|
37
|
-
tzinfo (0.3.
|
37
|
+
tzinfo (0.3.37)
|
38
38
|
|
39
39
|
PLATFORMS
|
40
40
|
java
|
41
41
|
|
42
42
|
DEPENDENCIES
|
43
|
-
activerecord (~> 3.1.
|
43
|
+
activerecord (~> 3.1.12)
|
44
44
|
appraisal
|
45
45
|
bcrypt-ruby (~> 3.0.0)
|
46
46
|
jruby-openssl
|
47
|
-
mocha (
|
47
|
+
mocha (>= 0.13.0)
|
48
48
|
rake
|
49
49
|
simplecov
|
50
|
-
test-unit
|
50
|
+
test-unit (= 2.5.4)
|
51
51
|
test-unit-context
|
data/gemfiles/rails32.gemfile
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# This file was generated by Appraisal
|
2
2
|
|
3
|
-
source "
|
3
|
+
source "https://rubygems.org"
|
4
4
|
|
5
5
|
gem "jruby-openssl", :platform=>:jruby
|
6
6
|
gem "appraisal"
|
7
7
|
gem "rake", :require=>nil
|
8
|
-
gem "test-unit", :group=>:test
|
8
|
+
gem "test-unit", "2.5.4", :group=>:test
|
9
9
|
gem "test-unit-context", :group=>:test
|
10
|
-
gem "mocha", "
|
10
|
+
gem "mocha", ">= 0.13.0", :require=>nil, :group=>:test
|
11
11
|
gem "simplecov", :require=>nil, :group=>:test
|
12
12
|
gem "bcrypt-ruby", "~> 3.0.0", :require=>nil, :group=>:test
|
13
|
-
gem "activerecord", "~> 3.2.
|
13
|
+
gem "activerecord", "~> 3.2.13"
|
14
14
|
|
@@ -1,29 +1,29 @@
|
|
1
1
|
GEM
|
2
|
-
remote:
|
2
|
+
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
|
-
activemodel (3.2.
|
5
|
-
activesupport (= 3.2.
|
4
|
+
activemodel (3.2.13)
|
5
|
+
activesupport (= 3.2.13)
|
6
6
|
builder (~> 3.0.0)
|
7
|
-
activerecord (3.2.
|
8
|
-
activemodel (= 3.2.
|
9
|
-
activesupport (= 3.2.
|
7
|
+
activerecord (3.2.13)
|
8
|
+
activemodel (= 3.2.13)
|
9
|
+
activesupport (= 3.2.13)
|
10
10
|
arel (~> 3.0.2)
|
11
11
|
tzinfo (~> 0.3.29)
|
12
|
-
activesupport (3.2.
|
13
|
-
i18n (
|
12
|
+
activesupport (3.2.13)
|
13
|
+
i18n (= 0.6.1)
|
14
14
|
multi_json (~> 1.0)
|
15
15
|
appraisal (0.5.1)
|
16
16
|
bundler
|
17
17
|
rake
|
18
18
|
arel (3.0.2)
|
19
19
|
bcrypt-ruby (3.0.1-java)
|
20
|
-
bouncy-castle-java (1.5.
|
20
|
+
bouncy-castle-java (1.5.0147)
|
21
21
|
builder (3.0.4)
|
22
22
|
i18n (0.6.1)
|
23
|
-
jruby-openssl (0.
|
24
|
-
bouncy-castle-java (>= 1.5.
|
23
|
+
jruby-openssl (0.8.4)
|
24
|
+
bouncy-castle-java (>= 1.5.0147)
|
25
25
|
metaclass (0.0.1)
|
26
|
-
mocha (0.
|
26
|
+
mocha (0.13.3)
|
27
27
|
metaclass (~> 0.0.1)
|
28
28
|
multi_json (1.5.0)
|
29
29
|
rake (10.0.3)
|
@@ -31,21 +31,21 @@ GEM
|
|
31
31
|
multi_json (~> 1.0)
|
32
32
|
simplecov-html (~> 0.7.1)
|
33
33
|
simplecov-html (0.7.1)
|
34
|
-
test-unit (2.5.
|
34
|
+
test-unit (2.5.4)
|
35
35
|
test-unit-context (0.3.0)
|
36
36
|
test-unit (>= 2.4.0)
|
37
|
-
tzinfo (0.3.
|
37
|
+
tzinfo (0.3.37)
|
38
38
|
|
39
39
|
PLATFORMS
|
40
40
|
java
|
41
41
|
|
42
42
|
DEPENDENCIES
|
43
|
-
activerecord (~> 3.2.
|
43
|
+
activerecord (~> 3.2.13)
|
44
44
|
appraisal
|
45
45
|
bcrypt-ruby (~> 3.0.0)
|
46
46
|
jruby-openssl
|
47
|
-
mocha (
|
47
|
+
mocha (>= 0.13.0)
|
48
48
|
rake
|
49
49
|
simplecov
|
50
|
-
test-unit
|
50
|
+
test-unit (= 2.5.4)
|
51
51
|
test-unit-context
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "activerecord"
|
6
|
+
gem "jruby-openssl", :platform=>:jruby
|
7
|
+
gem "appraisal"
|
8
|
+
gem "rake", :require=>nil
|
9
|
+
gem "test-unit", "2.5.4", :group=>:test
|
10
|
+
gem "test-unit-context", :group=>:test
|
11
|
+
gem "mocha", ">= 0.13.0", :require=>nil, :group=>:test
|
12
|
+
gem "simplecov", :require=>nil, :group=>:test
|
13
|
+
gem "bcrypt-ruby", "~> 3.0.0", :require=>nil, :group=>:test
|
14
|
+
gem "rails", :github=>"rails/rails"
|
15
|
+
gem "journey", :github=>"rails/journey"
|
16
|
+
gem "activerecord-deprecated_finders", :github=>"rails/activerecord-deprecated_finders", :require=>nil
|
17
|
+
|
@@ -0,0 +1,126 @@
|
|
1
|
+
GIT
|
2
|
+
remote: git://github.com/rails/activerecord-deprecated_finders.git
|
3
|
+
revision: 46aa99efc9c3c1db1d4f2e55373481212e6b2e26
|
4
|
+
specs:
|
5
|
+
activerecord-deprecated_finders (0.0.3)
|
6
|
+
|
7
|
+
GIT
|
8
|
+
remote: git://github.com/rails/journey.git
|
9
|
+
revision: f0938d664286dc0b47f13092fa5d04a9225038d4
|
10
|
+
specs:
|
11
|
+
journey (2.0.0.20120723141804)
|
12
|
+
|
13
|
+
GIT
|
14
|
+
remote: git://github.com/rails/rails.git
|
15
|
+
revision: 817e8fad5a84569729ae65fbd713274678c68d8f
|
16
|
+
specs:
|
17
|
+
actionmailer (4.0.0.beta1)
|
18
|
+
actionpack (= 4.0.0.beta1)
|
19
|
+
mail (~> 2.5.3)
|
20
|
+
actionpack (4.0.0.beta1)
|
21
|
+
activesupport (= 4.0.0.beta1)
|
22
|
+
builder (~> 3.1.0)
|
23
|
+
erubis (~> 2.7.0)
|
24
|
+
rack (~> 1.5.2)
|
25
|
+
rack-test (~> 0.6.2)
|
26
|
+
activemodel (4.0.0.beta1)
|
27
|
+
activesupport (= 4.0.0.beta1)
|
28
|
+
builder (~> 3.1.0)
|
29
|
+
activerecord (4.0.0.beta1)
|
30
|
+
activemodel (= 4.0.0.beta1)
|
31
|
+
activerecord-deprecated_finders (~> 0.0.3)
|
32
|
+
activesupport (= 4.0.0.beta1)
|
33
|
+
arel (~> 4.0.0.beta2)
|
34
|
+
activesupport (4.0.0.beta1)
|
35
|
+
i18n (~> 0.6, >= 0.6.4)
|
36
|
+
minitest (~> 4.2)
|
37
|
+
multi_json (~> 1.3)
|
38
|
+
thread_safe (~> 0.1)
|
39
|
+
tzinfo (~> 0.3.37)
|
40
|
+
rails (4.0.0.beta1)
|
41
|
+
actionmailer (= 4.0.0.beta1)
|
42
|
+
actionpack (= 4.0.0.beta1)
|
43
|
+
activerecord (= 4.0.0.beta1)
|
44
|
+
activesupport (= 4.0.0.beta1)
|
45
|
+
bundler (>= 1.3.0, < 2.0)
|
46
|
+
railties (= 4.0.0.beta1)
|
47
|
+
sprockets-rails (~> 2.0.0.rc3)
|
48
|
+
railties (4.0.0.beta1)
|
49
|
+
actionpack (= 4.0.0.beta1)
|
50
|
+
activesupport (= 4.0.0.beta1)
|
51
|
+
rake (>= 0.8.7)
|
52
|
+
thor (>= 0.18.1, < 2.0)
|
53
|
+
|
54
|
+
GEM
|
55
|
+
remote: https://rubygems.org/
|
56
|
+
specs:
|
57
|
+
appraisal (0.5.2)
|
58
|
+
bundler
|
59
|
+
rake
|
60
|
+
arel (4.0.0.beta2)
|
61
|
+
atomic (1.1.6-java)
|
62
|
+
bcrypt-ruby (3.0.1)
|
63
|
+
bcrypt-ruby (3.0.1-java)
|
64
|
+
bouncy-castle-java (1.5.0147)
|
65
|
+
builder (3.1.4)
|
66
|
+
erubis (2.7.0)
|
67
|
+
hike (1.2.2)
|
68
|
+
i18n (0.6.4)
|
69
|
+
jruby-openssl (0.8.7)
|
70
|
+
bouncy-castle-java (>= 1.5.0147)
|
71
|
+
mail (2.5.3)
|
72
|
+
i18n (>= 0.4.0)
|
73
|
+
mime-types (~> 1.16)
|
74
|
+
treetop (~> 1.4.8)
|
75
|
+
metaclass (0.0.1)
|
76
|
+
mime-types (1.22)
|
77
|
+
minitest (4.7.0)
|
78
|
+
mocha (0.13.3)
|
79
|
+
metaclass (~> 0.0.1)
|
80
|
+
multi_json (1.7.2)
|
81
|
+
polyglot (0.3.3)
|
82
|
+
rack (1.5.2)
|
83
|
+
rack-test (0.6.2)
|
84
|
+
rack (>= 1.0)
|
85
|
+
rake (10.0.4)
|
86
|
+
simplecov (0.7.1)
|
87
|
+
multi_json (~> 1.0)
|
88
|
+
simplecov-html (~> 0.7.1)
|
89
|
+
simplecov-html (0.7.1)
|
90
|
+
sprockets (2.9.2)
|
91
|
+
hike (~> 1.2)
|
92
|
+
multi_json (~> 1.0)
|
93
|
+
rack (~> 1.0)
|
94
|
+
tilt (~> 1.1, != 1.3.0)
|
95
|
+
sprockets-rails (2.0.0.rc3)
|
96
|
+
actionpack (>= 3.0)
|
97
|
+
activesupport (>= 3.0)
|
98
|
+
sprockets (~> 2.8)
|
99
|
+
test-unit (2.5.4)
|
100
|
+
test-unit-context (0.3.0)
|
101
|
+
test-unit (>= 2.4.0)
|
102
|
+
thor (0.18.1)
|
103
|
+
thread_safe (0.1.0)
|
104
|
+
atomic
|
105
|
+
tilt (1.3.6)
|
106
|
+
treetop (1.4.12)
|
107
|
+
polyglot
|
108
|
+
polyglot (>= 0.3.1)
|
109
|
+
tzinfo (0.3.37)
|
110
|
+
|
111
|
+
PLATFORMS
|
112
|
+
java
|
113
|
+
|
114
|
+
DEPENDENCIES
|
115
|
+
activerecord
|
116
|
+
activerecord-deprecated_finders!
|
117
|
+
appraisal
|
118
|
+
bcrypt-ruby (~> 3.0.0)
|
119
|
+
journey!
|
120
|
+
jruby-openssl
|
121
|
+
mocha (>= 0.13.0)
|
122
|
+
rails!
|
123
|
+
rake
|
124
|
+
simplecov
|
125
|
+
test-unit (= 2.5.4)
|
126
|
+
test-unit-context
|
data/lib/arjdbc.rb
CHANGED
@@ -11,16 +11,17 @@ if defined?(JRUBY_VERSION)
|
|
11
11
|
require 'active_record'
|
12
12
|
end
|
13
13
|
rescue LoadError => e
|
14
|
-
warn "activerecord-jdbc-adapter requires
|
14
|
+
warn "activerecord-jdbc-adapter requires ActiveRecord at runtime"
|
15
15
|
raise e
|
16
16
|
end
|
17
17
|
require 'arjdbc/jdbc'
|
18
|
+
begin
|
19
|
+
require 'arjdbc/railtie'
|
20
|
+
rescue LoadError => e
|
21
|
+
warn "activerecord-jdbc-adapter failed to load railtie: #{e.inspect}"
|
22
|
+
end if defined?(Rails) && ActiveRecord::VERSION::MAJOR >= 3
|
18
23
|
else
|
19
24
|
warn "activerecord-jdbc-adapter is for use with JRuby only"
|
20
25
|
end
|
21
26
|
|
22
27
|
require 'arjdbc/version'
|
23
|
-
if ActiveRecord::VERSION::MAJOR > 3
|
24
|
-
warn "activerecord-jdbc-adapter #{ArJdbc::Version::VERSION} only (officialy) " <<
|
25
|
-
"supports activerecord <= 3.2, please use gem 'activerecord-jdbc-adapter', '>= 1.3.0'"
|
26
|
-
end
|
data/lib/arjdbc/db2.rb
CHANGED
data/lib/arjdbc/db2/adapter.rb
CHANGED
@@ -57,8 +57,10 @@ module ArJdbc
|
|
57
57
|
{ 'db2' => ::Arel::Visitors::DB2, 'as400' => ::Arel::Visitors::DB2 }
|
58
58
|
end
|
59
59
|
|
60
|
+
ADAPTER_NAME = 'DB2'
|
61
|
+
|
60
62
|
def adapter_name
|
61
|
-
|
63
|
+
ADAPTER_NAME
|
62
64
|
end
|
63
65
|
|
64
66
|
NATIVE_DATABASE_TYPES = {
|
@@ -76,7 +78,9 @@ module ArJdbc
|
|
76
78
|
#:rowid => { :name => "rowid" }, # supported datatype on z/OS and i/5
|
77
79
|
#:graphic => { :name => "graphic", :limit => 1 },
|
78
80
|
#:vargraphic => { :name => "vargraphic", :limit => 1 },
|
79
|
-
|
81
|
+
:datetime => { :name => "timestamp" },
|
82
|
+
:timestamp => { :name => "timestamp" },
|
83
|
+
:time => { :name => "time" }
|
80
84
|
}
|
81
85
|
|
82
86
|
def native_database_types
|
@@ -88,8 +92,8 @@ module ArJdbc
|
|
88
92
|
return nil if value.nil? || value == 'NULL' || value =~ /^\s*NULL\s*$/i
|
89
93
|
case type
|
90
94
|
when :string then value
|
91
|
-
when :integer then
|
92
|
-
when :primary_key then
|
95
|
+
when :integer then value.respond_to?(:to_i) ? value.to_i : (value ? 1 : 0)
|
96
|
+
when :primary_key then value.respond_to?(:to_i) ? value.to_i : (value ? 1 : 0)
|
93
97
|
when :float then value.to_f
|
94
98
|
when :datetime then ArJdbc::DB2::Column.cast_to_date_or_time(value)
|
95
99
|
when :date then ArJdbc::DB2::Column.cast_to_date_or_time(value)
|
@@ -173,19 +177,29 @@ module ArJdbc
|
|
173
177
|
value
|
174
178
|
end
|
175
179
|
end
|
180
|
+
|
181
|
+
class TableDefinition < ::ActiveRecord::ConnectionAdapters::TableDefinition # :nodoc:
|
182
|
+
def xml(*args)
|
183
|
+
options = args.extract_options!
|
184
|
+
column(args[0], 'xml', options)
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
def table_definition(*args)
|
189
|
+
new_table_definition(TableDefinition, *args)
|
190
|
+
end
|
176
191
|
|
177
192
|
def prefetch_primary_key?(table_name = nil)
|
178
193
|
# TRUE if the table has no identity column
|
179
194
|
names = table_name.upcase.split(".")
|
180
|
-
sql = ""
|
181
195
|
if as400?
|
182
196
|
sql = "SELECT 1 FROM SYSIBM.SQLPRIMARYKEYS WHERE "
|
183
|
-
sql
|
184
|
-
sql
|
197
|
+
sql << "TABLE_SCHEM = '#{names.first}' AND " if names.size == 2
|
198
|
+
sql << "TABLE_NAME = '#{names.last}'"
|
185
199
|
else
|
186
200
|
sql = "SELECT 1 FROM SYSCAT.COLUMNS WHERE IDENTITY = 'Y' "
|
187
|
-
sql
|
188
|
-
sql
|
201
|
+
sql << "AND TABSCHEMA = '#{names.first}' " if names.size == 2
|
202
|
+
sql << "AND TABNAME = '#{names.last}'"
|
189
203
|
end
|
190
204
|
select_one(sql).nil?
|
191
205
|
end
|
@@ -201,7 +215,7 @@ module ArJdbc
|
|
201
215
|
@connection.execute_update "call qsys.qcmdexc('ADDRPYLE SEQNBR(9876) MSGID(CPA32B2) RPY(''I'')',0000000045.00000)"
|
202
216
|
rescue Exception => e
|
203
217
|
raise "Could not call CHGJOB INQMSGRPY(*SYSRPYL) and ADDRPYLE SEQNBR(9876) MSGID(CPA32B2) RPY('I').\n" +
|
204
|
-
"Do you have authority to do this?\n\n
|
218
|
+
"Do you have authority to do this?\n\n#{e.inspect}"
|
205
219
|
end
|
206
220
|
|
207
221
|
result = execute sql
|
@@ -211,20 +225,21 @@ module ArJdbc
|
|
211
225
|
@connection.execute_update "call qsys.qcmdexc('RMVRPYLE SEQNBR(9876)',0000000021.00000)"
|
212
226
|
rescue Exception => e
|
213
227
|
raise "Could not call CHGJOB INQMSGRPY(*DFT) and RMVRPYLE SEQNBR(9876).\n" +
|
214
|
-
"Do you have authority to do this?\n\n
|
228
|
+
"Do you have authority to do this?\n\n#{e.inspect}"
|
215
229
|
end
|
216
230
|
result
|
217
231
|
end
|
218
232
|
|
219
233
|
def _execute(sql, name = nil)
|
220
234
|
if self.class.select?(sql)
|
221
|
-
@connection.
|
235
|
+
@connection.execute_query_raw(sql)
|
222
236
|
elsif self.class.insert?(sql)
|
223
|
-
(@connection.execute_insert(sql)
|
237
|
+
(@connection.execute_insert(sql) || last_insert_id(sql)).to_i
|
224
238
|
else
|
225
239
|
@connection.execute_update(sql)
|
226
240
|
end
|
227
241
|
end
|
242
|
+
private :_execute
|
228
243
|
|
229
244
|
def last_insert_id(sql)
|
230
245
|
table_name = sql.split(/\s/)[2]
|
@@ -240,9 +255,12 @@ module ArJdbc
|
|
240
255
|
end
|
241
256
|
end
|
242
257
|
|
243
|
-
def zos_create_table(name, options = {})
|
244
|
-
|
245
|
-
table_definition
|
258
|
+
def zos_create_table(name, options = {}) # :nodoc:
|
259
|
+
# NOTE: this won't work for 4.0 - need to pass different initialize args :
|
260
|
+
table_definition = TableDefinition.new(self)
|
261
|
+
unless options[:id] == false
|
262
|
+
table_definition.primary_key(options[:primary_key] || primary_key(name))
|
263
|
+
end
|
246
264
|
|
247
265
|
yield table_definition
|
248
266
|
|
@@ -338,11 +356,18 @@ module ArJdbc
|
|
338
356
|
"'#{quote_string(value)}'"
|
339
357
|
end
|
340
358
|
elsif column_type == :xml
|
341
|
-
"#{value}" # "'<ibm>@@@IBMXML@@@</ibm>'"
|
359
|
+
value.nil? ? "NULL" : "'#{quote_string(value)}'" # "'<ibm>@@@IBMXML@@@</ibm>'"
|
342
360
|
else
|
343
361
|
"'#{quote_string(value)}'"
|
344
362
|
end
|
345
363
|
when Symbol then "'#{quote_string(value.to_s)}'"
|
364
|
+
when Time
|
365
|
+
# AS400 doesn't support date in time column
|
366
|
+
if column && column_type == :time
|
367
|
+
"'#{value.strftime("%H:%M:%S")}'"
|
368
|
+
else
|
369
|
+
super
|
370
|
+
end
|
346
371
|
else super
|
347
372
|
end
|
348
373
|
end
|
@@ -411,14 +436,12 @@ module ArJdbc
|
|
411
436
|
sql
|
412
437
|
end
|
413
438
|
|
414
|
-
def reorg_table(table_name)
|
415
|
-
unless as400?
|
416
|
-
@connection.execute_update "call sysproc.admin_cmd ('REORG TABLE #{table_name}')"
|
417
|
-
end
|
439
|
+
def reorg_table(table_name, name = nil)
|
440
|
+
exec_update "call sysproc.admin_cmd ('REORG TABLE #{table_name}')", name, [] unless as400?
|
418
441
|
end
|
419
442
|
private :reorg_table
|
420
443
|
|
421
|
-
def runstats_for_table(tablename, priority=10)
|
444
|
+
def runstats_for_table(tablename, priority = 10)
|
422
445
|
@connection.execute_update "call sysproc.admin_cmd('RUNSTATS ON TABLE #{tablename} WITH DISTRIBUTION AND DETAILED INDEXES ALL UTIL_IMPACT_PRIORITY #{priority}')"
|
423
446
|
end
|
424
447
|
|
@@ -451,7 +474,7 @@ module ArJdbc
|
|
451
474
|
raise NotImplementedError, "rename_column is not supported on IBM i"
|
452
475
|
else
|
453
476
|
execute "ALTER TABLE #{table_name} RENAME COLUMN #{column_name} TO #{new_column_name}"
|
454
|
-
reorg_table(table_name)
|
477
|
+
reorg_table(table_name, 'Rename Column')
|
455
478
|
end
|
456
479
|
end
|
457
480
|
|
@@ -462,7 +485,7 @@ module ArJdbc
|
|
462
485
|
sql = "ALTER TABLE #{table_name} ALTER COLUMN #{column_name} SET NOT NULL"
|
463
486
|
end
|
464
487
|
as400? ? execute_and_auto_confirm(sql) : execute(sql)
|
465
|
-
reorg_table(table_name)
|
488
|
+
reorg_table(table_name, 'Change Column')
|
466
489
|
end
|
467
490
|
|
468
491
|
def change_column_default(table_name, column_name, default)
|
@@ -472,14 +495,14 @@ module ArJdbc
|
|
472
495
|
sql = "ALTER TABLE #{table_name} ALTER COLUMN #{column_name} SET WITH DEFAULT #{quote(default)}"
|
473
496
|
end
|
474
497
|
as400? ? execute_and_auto_confirm(sql) : execute(sql)
|
475
|
-
reorg_table(table_name)
|
498
|
+
reorg_table(table_name, 'Change Column')
|
476
499
|
end
|
477
500
|
|
478
501
|
def change_column(table_name, column_name, type, options = {})
|
479
502
|
data_type = type_to_sql(type, options[:limit], options[:precision], options[:scale])
|
480
503
|
sql = "ALTER TABLE #{table_name} ALTER COLUMN #{column_name} SET DATA TYPE #{data_type}"
|
481
504
|
as400? ? execute_and_auto_confirm(sql) : execute(sql)
|
482
|
-
reorg_table(table_name)
|
505
|
+
reorg_table(table_name, 'Change Column')
|
483
506
|
|
484
507
|
if options.include?(:default) and options.include?(:null)
|
485
508
|
# which to run first?
|
@@ -503,13 +526,13 @@ module ArJdbc
|
|
503
526
|
sql = "ALTER TABLE #{table_name} DROP COLUMN #{column_name}"
|
504
527
|
as400? ? execute_and_auto_confirm(sql) : execute(sql)
|
505
528
|
end
|
506
|
-
reorg_table(table_name)
|
529
|
+
reorg_table(table_name, 'Remove Column')
|
507
530
|
end
|
508
531
|
|
509
532
|
# http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/topic/com.ibm.db2.luw.sql.ref.doc/doc/r0000980.html
|
510
533
|
def rename_table(name, new_name) #:nodoc:
|
511
534
|
execute "RENAME TABLE #{name} TO #{new_name}"
|
512
|
-
reorg_table(new_name)
|
535
|
+
reorg_table(new_name, 'Rename Table')
|
513
536
|
end
|
514
537
|
|
515
538
|
def tables
|
@@ -523,7 +546,7 @@ module ArJdbc
|
|
523
546
|
HAVE_SCALE = %w(DECIMAL NUMERIC)
|
524
547
|
|
525
548
|
def columns(table_name, name = nil)
|
526
|
-
columns = @connection.
|
549
|
+
columns = @connection.columns_internal(table_name.to_s, nil, db2_schema)
|
527
550
|
|
528
551
|
if zos?
|
529
552
|
# Remove the mighty db2_generated_rowid_for_lobs from the list of columns
|