activerecord-jdbc-adapter 1.2.5 → 1.2.8
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/.travis.yml +5 -1
- data/Appraisals +5 -5
- data/Gemfile +9 -1
- data/Gemfile.lock +44 -10
- data/History.txt +126 -2
- data/README.md +246 -0
- data/Rakefile +34 -25
- data/activerecord-jdbc-adapter.gemspec +1 -1
- data/gemfiles/rails23.gemfile +5 -3
- data/gemfiles/rails23.gemfile.lock +26 -18
- data/gemfiles/rails30.gemfile +4 -2
- data/gemfiles/rails30.gemfile.lock +16 -8
- data/gemfiles/rails31.gemfile +4 -2
- data/gemfiles/rails31.gemfile.lock +16 -9
- data/gemfiles/rails32.gemfile +4 -2
- data/gemfiles/rails32.gemfile.lock +15 -8
- data/lib/active_record/connection_adapters/db2_adapter.rb +1 -0
- data/lib/arel/visitors/sql_server.rb +3 -0
- data/lib/arjdbc.rb +3 -5
- data/lib/arjdbc/db2.rb +1 -0
- data/lib/arjdbc/db2/adapter.rb +302 -196
- data/lib/arjdbc/db2/connection_methods.rb +18 -0
- data/lib/arjdbc/derby/active_record_patch.rb +12 -0
- data/lib/arjdbc/derby/adapter.rb +180 -158
- data/lib/arjdbc/derby/connection_methods.rb +5 -1
- data/lib/arjdbc/firebird/adapter.rb +27 -19
- data/lib/arjdbc/h2/adapter.rb +162 -7
- data/lib/arjdbc/h2/connection_methods.rb +5 -1
- data/lib/arjdbc/hsqldb.rb +1 -1
- data/lib/arjdbc/hsqldb/adapter.rb +96 -61
- data/lib/arjdbc/hsqldb/connection_methods.rb +5 -1
- data/lib/arjdbc/hsqldb/explain_support.rb +35 -0
- data/lib/arjdbc/informix/adapter.rb +56 -55
- data/lib/arjdbc/jdbc/adapter.rb +173 -86
- data/lib/arjdbc/jdbc/adapter_java.jar +0 -0
- data/lib/arjdbc/jdbc/column.rb +28 -23
- data/lib/arjdbc/jdbc/connection.rb +10 -6
- data/lib/arjdbc/jdbc/driver.rb +13 -5
- data/lib/arjdbc/jdbc/serialized_attributes_helper.rb +21 -0
- data/lib/arjdbc/mssql.rb +1 -1
- data/lib/arjdbc/mssql/adapter.rb +51 -53
- data/lib/arjdbc/mssql/connection_methods.rb +8 -1
- data/lib/arjdbc/mysql.rb +1 -1
- data/lib/arjdbc/mysql/adapter.rb +186 -150
- data/lib/arjdbc/mysql/connection_methods.rb +9 -9
- data/lib/arjdbc/mysql/explain_support.rb +85 -0
- data/lib/arjdbc/oracle.rb +1 -1
- data/lib/arjdbc/oracle/adapter.rb +232 -125
- data/lib/arjdbc/oracle/connection_methods.rb +2 -2
- data/lib/arjdbc/postgresql.rb +1 -1
- data/lib/arjdbc/postgresql/adapter.rb +134 -86
- data/lib/arjdbc/postgresql/connection_methods.rb +6 -4
- data/lib/arjdbc/postgresql/explain_support.rb +55 -0
- data/lib/arjdbc/sqlite3.rb +1 -1
- data/lib/arjdbc/sqlite3/adapter.rb +176 -108
- data/lib/arjdbc/sqlite3/connection_methods.rb +5 -5
- data/lib/arjdbc/sqlite3/explain_support.rb +32 -0
- data/lib/arjdbc/sybase/adapter.rb +7 -6
- data/lib/arjdbc/version.rb +1 -1
- data/pom.xml +1 -1
- data/rakelib/02-test.rake +9 -11
- data/rakelib/rails.rake +18 -10
- data/src/java/arjdbc/db2/DB2Module.java +70 -0
- data/src/java/arjdbc/derby/DerbyModule.java +24 -5
- data/src/java/arjdbc/hsqldb/HSQLDBModule.java +66 -0
- data/src/java/arjdbc/jdbc/AdapterJavaService.java +14 -7
- data/src/java/arjdbc/jdbc/RubyJdbcConnection.java +111 -89
- data/src/java/arjdbc/mysql/MySQLModule.java +79 -70
- data/src/java/arjdbc/oracle/OracleModule.java +74 -0
- data/src/java/arjdbc/oracle/OracleRubyJdbcConnection.java +5 -10
- data/src/java/arjdbc/sqlite3/SQLite3Module.java +77 -0
- data/src/java/arjdbc/sqlite3/SQLite3RubyJdbcConnection.java +127 -0
- data/src/java/arjdbc/sqlite3/Sqlite3RubyJdbcConnection.java +25 -111
- data/src/java/arjdbc/util/QuotingUtils.java +104 -0
- data/test/abstract_db_create.rb +6 -6
- data/test/activerecord/connection_adapters/type_conversion_test.rb +2 -2
- data/test/assets/flowers.jpg +0 -0
- data/test/binary.rb +67 -0
- data/test/db/db2.rb +30 -7
- data/test/db/jdbc.rb +4 -2
- data/test/db/oracle.rb +18 -27
- data/test/db2_binary_test.rb +6 -0
- data/test/db2_serialize_test.rb +6 -0
- data/test/db2_simple_test.rb +20 -25
- data/test/db2_test.rb +71 -0
- data/test/derby_binary_test.rb +6 -0
- data/test/derby_migration_test.rb +42 -35
- data/test/derby_reset_column_information_test.rb +1 -0
- data/test/derby_row_locking_test.rb +17 -0
- data/test/derby_schema_dump_test.rb +9 -0
- data/test/derby_serialize_test.rb +6 -0
- data/test/derby_simple_test.rb +59 -17
- data/test/generic_jdbc_connection_test.rb +112 -5
- data/test/h2_binary_test.rb +6 -0
- data/test/h2_change_column_test.rb +1 -1
- data/test/h2_schema_dump_test.rb +25 -0
- data/test/h2_serialize_test.rb +6 -0
- data/test/h2_simple_test.rb +23 -9
- data/test/has_many_through.rb +18 -4
- data/test/hsqldb_binary_test.rb +6 -0
- data/test/hsqldb_schema_dump_test.rb +15 -0
- data/test/hsqldb_serialize_test.rb +6 -0
- data/test/hsqldb_simple_test.rb +1 -0
- data/test/informix_simple_test.rb +1 -1
- data/test/jdbc/db2.rb +23 -0
- data/test/jdbc/oracle.rb +23 -0
- data/test/jdbc_common.rb +3 -110
- data/test/jndi_callbacks_test.rb +0 -2
- data/test/jndi_test.rb +2 -0
- data/test/models/binary.rb +18 -0
- data/test/models/custom_pk_name.rb +1 -0
- data/test/models/data_types.rb +11 -2
- data/test/models/entry.rb +1 -1
- data/test/models/string_id.rb +2 -2
- data/test/models/thing.rb +1 -1
- data/test/models/topic.rb +32 -0
- data/test/mssql_legacy_types_test.rb +1 -1
- data/test/mssql_limit_offset_test.rb +13 -3
- data/test/mssql_serialize_test.rb +6 -0
- data/test/mysql_binary_test.rb +6 -0
- data/test/mysql_schema_dump_test.rb +220 -0
- data/test/mysql_serialize_test.rb +6 -0
- data/test/mysql_simple_test.rb +22 -2
- data/test/mysql_test.rb +93 -0
- data/test/oracle_binary_test.rb +6 -0
- data/test/oracle_limit_test.rb +2 -1
- data/test/oracle_serialize_test.rb +6 -0
- data/test/oracle_simple_test.rb +61 -0
- data/test/oracle_specific_test.rb +77 -26
- data/test/postgres_binary_test.rb +6 -0
- data/test/postgres_native_type_mapping_test.rb +12 -11
- data/test/postgres_nonseq_pkey_test.rb +1 -0
- data/test/postgres_reserved_test.rb +1 -0
- data/test/postgres_reset_column_information_test.rb +1 -0
- data/test/postgres_row_locking_test.rb +21 -0
- data/test/postgres_schema_dump_test.rb +88 -0
- data/test/postgres_schema_search_path_test.rb +1 -0
- data/test/postgres_simple_test.rb +62 -89
- data/test/postgres_table_alias_length_test.rb +1 -0
- data/test/postgres_test.rb +31 -0
- data/test/postgres_type_conversion_test.rb +16 -16
- data/test/row_locking.rb +69 -64
- data/test/schema_dump.rb +168 -0
- data/test/serialize.rb +277 -0
- data/test/simple.rb +326 -122
- data/test/sqlite3_serialize_test.rb +6 -0
- data/test/sqlite3_simple_test.rb +51 -84
- data/test/sqlite3_type_conversion_test.rb +101 -0
- data/test/test_helper.rb +224 -0
- metadata +325 -366
- data/README.rdoc +0 -214
- data/test/db/logger.rb +0 -3
- data/test/derby_multibyte_test.rb +0 -11
- data/test/mysql_info_test.rb +0 -123
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -6,10 +6,13 @@ rvm:
|
|
6
6
|
env:
|
7
7
|
- DB=mysql
|
8
8
|
- DB=postgresql
|
9
|
+
- DB=sqlite3
|
10
|
+
# derby - tested with test_jndi
|
11
|
+
#- DB=derby
|
9
12
|
- DB=h2
|
10
13
|
- DB=hsqldb
|
11
|
-
- DB=sqlite3
|
12
14
|
- DB=jndi
|
15
|
+
- DB=jdbc
|
13
16
|
gemfile:
|
14
17
|
- gemfiles/rails23.gemfile
|
15
18
|
- gemfiles/rails30.gemfile
|
@@ -18,6 +21,7 @@ gemfile:
|
|
18
21
|
branches:
|
19
22
|
only:
|
20
23
|
- master
|
24
|
+
- 1-2-stable
|
21
25
|
matrix:
|
22
26
|
allow_failures:
|
23
27
|
- gemfile: gemfiles/rails23.gemfile
|
data/Appraisals
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
appraise "rails23" do
|
2
|
-
gem "activerecord", "~> 2.3.
|
3
|
-
gem "rails", "~> 2.3.
|
2
|
+
gem "activerecord", "~> 2.3.16"
|
3
|
+
gem "rails", "~> 2.3.16"
|
4
4
|
end
|
5
5
|
|
6
6
|
appraise "rails30" do
|
7
|
-
gem "activerecord", "~> 3.0.
|
7
|
+
gem "activerecord", "~> 3.0.20"
|
8
8
|
end
|
9
9
|
|
10
10
|
appraise "rails31" do
|
11
|
-
gem "activerecord", "~> 3.1.
|
11
|
+
gem "activerecord", "~> 3.1.10"
|
12
12
|
end
|
13
13
|
|
14
14
|
appraise "rails32" do
|
15
|
-
gem "activerecord", "~> 3.2.
|
15
|
+
gem "activerecord", "~> 3.2.11"
|
16
16
|
end
|
data/Gemfile
CHANGED
@@ -11,4 +11,12 @@ gem 'appraisal'
|
|
11
11
|
gem 'rake', :require => nil
|
12
12
|
# appraisal ignores group block declarations :
|
13
13
|
gem 'test-unit', :group => :test
|
14
|
-
gem 'mocha', :group => :test
|
14
|
+
gem 'mocha', :require => nil, :group => :test # '>= 0.13.0'
|
15
|
+
gem 'simplecov', :require => nil, :group => :test
|
16
|
+
gem 'bcrypt-ruby', '~> 3.0.0', :require => nil, :group => :test
|
17
|
+
|
18
|
+
group :rails do
|
19
|
+
gem 'erubis', :require => nil
|
20
|
+
# NOTE: due rails/activerecord/test/cases/session_store/session_test.rb
|
21
|
+
gem 'actionpack', :require => nil
|
22
|
+
end
|
data/Gemfile.lock
CHANGED
@@ -1,32 +1,52 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
|
5
|
-
|
4
|
+
actionpack (3.2.11)
|
5
|
+
activemodel (= 3.2.11)
|
6
|
+
activesupport (= 3.2.11)
|
6
7
|
builder (~> 3.0.0)
|
7
|
-
|
8
|
-
|
9
|
-
|
8
|
+
erubis (~> 2.7.0)
|
9
|
+
journey (~> 1.0.4)
|
10
|
+
rack (~> 1.4.0)
|
11
|
+
rack-cache (~> 1.2)
|
12
|
+
rack-test (~> 0.6.1)
|
13
|
+
sprockets (~> 2.2.1)
|
14
|
+
activemodel (3.2.11)
|
15
|
+
activesupport (= 3.2.11)
|
16
|
+
builder (~> 3.0.0)
|
17
|
+
activerecord (3.2.11)
|
18
|
+
activemodel (= 3.2.11)
|
19
|
+
activesupport (= 3.2.11)
|
10
20
|
arel (~> 3.0.2)
|
11
21
|
tzinfo (~> 0.3.29)
|
12
|
-
activesupport (3.2.
|
22
|
+
activesupport (3.2.11)
|
13
23
|
i18n (~> 0.6)
|
14
24
|
multi_json (~> 1.0)
|
15
25
|
appraisal (0.5.1)
|
16
26
|
bundler
|
17
27
|
rake
|
18
28
|
arel (3.0.2)
|
29
|
+
bcrypt-ruby (3.0.1)
|
30
|
+
bcrypt-ruby (3.0.1-java)
|
19
31
|
bouncy-castle-java (1.5.0146.1)
|
20
32
|
builder (3.0.4)
|
21
33
|
columnize (0.3.6)
|
34
|
+
erubis (2.7.0)
|
35
|
+
hike (1.2.1)
|
22
36
|
i18n (0.6.1)
|
23
|
-
|
37
|
+
journey (1.0.4)
|
38
|
+
jruby-openssl (0.8.2)
|
24
39
|
bouncy-castle-java (>= 1.5.0146.1)
|
25
40
|
linecache (0.46-java)
|
26
41
|
metaclass (0.0.1)
|
27
|
-
mocha (0.
|
42
|
+
mocha (0.13.2)
|
28
43
|
metaclass (~> 0.0.1)
|
29
|
-
multi_json (1.
|
44
|
+
multi_json (1.5.0)
|
45
|
+
rack (1.4.4)
|
46
|
+
rack-cache (1.2)
|
47
|
+
rack (>= 0.4)
|
48
|
+
rack-test (0.6.2)
|
49
|
+
rack (>= 1.0)
|
30
50
|
rake (10.0.3)
|
31
51
|
ruby-debug (0.10.4)
|
32
52
|
columnize (>= 0.1)
|
@@ -34,17 +54,31 @@ GEM
|
|
34
54
|
ruby-debug-base (0.10.4)
|
35
55
|
linecache (>= 0.3)
|
36
56
|
ruby-debug-base (0.10.4-java)
|
37
|
-
|
57
|
+
simplecov (0.7.1)
|
58
|
+
multi_json (~> 1.0)
|
59
|
+
simplecov-html (~> 0.7.1)
|
60
|
+
simplecov-html (0.7.1)
|
61
|
+
sprockets (2.2.2)
|
62
|
+
hike (~> 1.2)
|
63
|
+
multi_json (~> 1.0)
|
64
|
+
rack (~> 1.0)
|
65
|
+
tilt (~> 1.1, != 1.3.0)
|
66
|
+
test-unit (2.5.4)
|
67
|
+
tilt (1.3.3)
|
38
68
|
tzinfo (0.3.35)
|
39
69
|
|
40
70
|
PLATFORMS
|
41
71
|
java
|
42
72
|
|
43
73
|
DEPENDENCIES
|
74
|
+
actionpack
|
44
75
|
activerecord
|
45
76
|
appraisal
|
77
|
+
bcrypt-ruby (~> 3.0.0)
|
78
|
+
erubis
|
46
79
|
jruby-openssl
|
47
80
|
mocha
|
48
81
|
rake
|
49
82
|
ruby-debug
|
83
|
+
simplecov
|
50
84
|
test-unit
|
data/History.txt
CHANGED
@@ -1,3 +1,127 @@
|
|
1
|
+
== 1.2.8 (03/13/13)
|
2
|
+
|
3
|
+
- [derby] (native) types review & cleanup, externalize AR patch-ing
|
4
|
+
- [h2] correct schema dump (jdbc detected sql types)
|
5
|
+
- [hsqldb] correct schema dump (jdbc detected sql types)
|
6
|
+
- cleanup H2 / HSQLDB adapter - HSQLDB should not know about H2
|
7
|
+
- [mssql] [oracle] [db2] [derby] remove_column 3.x compatibility
|
8
|
+
- [sqlite3] setup native types + make sure tables accepts table_name as well
|
9
|
+
- [mysql] version + support_"feature" (as Rails)
|
10
|
+
- jdbc_connection unwrap parameter for unwrapping (pooled) connections
|
11
|
+
- (native) connection #columns #columns_internal expects string table_name
|
12
|
+
- [postgres] no need to clear_query_cache after insert on AR-2.3's #insert_sql
|
13
|
+
- there's still a double bind when "raw" crud methods used (re-closing #322)
|
14
|
+
|
15
|
+
== 1.2.7 (02/12/13)
|
16
|
+
|
17
|
+
- add some (probably redundant) synchronization + "arjdbc.disconnect.debug" flag
|
18
|
+
as an attempt to detect when connection is set to null (#197 and #198)
|
19
|
+
avoid (deprecated) Java.java_to_ruby when wrapping java.sql.Connection
|
20
|
+
- follow Column-naming convention in MySQL adapter ArJdbc module
|
21
|
+
- make sure update_sql is public in mysql adapter (Rails compatibility)
|
22
|
+
- fix 1.2.6 regression - incorrectly setup to_sql method based on Rails version
|
23
|
+
this caused double '?' bind substitution issues (#322)
|
24
|
+
|
25
|
+
== 1.2.6 (01/31/13)
|
26
|
+
|
27
|
+
- [postgres] only set --schema (to search path) for pg_dump if configured (#315)
|
28
|
+
- [oracle] id limits + quoting; current user/db/schema + savepoint support
|
29
|
+
- execute "log" (sql) name correctly based on AR version
|
30
|
+
- deprecate substitute_binds and extract_sql
|
31
|
+
- [derby] make sure we never modify the passed sql param
|
32
|
+
- [sqlite3] execute on insert_sql + savepoint support
|
33
|
+
- [mssql] [firebird] [informix] (shared) serialized attribute support
|
34
|
+
- [oracle] (shared) serialized attribute support
|
35
|
+
- [sqlite3] fix binary column handling failure (#51)
|
36
|
+
- renamed Sqlite3RubyJdbcConnection to SQLite3RubyJdbcConnection
|
37
|
+
- [mysql] re-define remove_index! for "better" AR-2.3 compatibility
|
38
|
+
- [derby] avoid failures with #quote when second arg nil + keep string encoding
|
39
|
+
- [db2] binary support & improved quoting +
|
40
|
+
use lob callback for all since it was failing on BLOB/CLOB inserts otherwise
|
41
|
+
- [db2] better (simplified) type handling for DB2
|
42
|
+
- JRuby 1.6.8 compatibility when rescue-ing Java exception
|
43
|
+
- [mysql] avoid encoding issues with MySQL's quoting methods (#185)
|
44
|
+
- [postgres] ignore binary precision / limit for bytea
|
45
|
+
- [oracle] explain (query) support
|
46
|
+
- [oracle] since Oracle supports TIMESTAMP for quite a while we should not
|
47
|
+
create DATE columns for a :timestamp column type
|
48
|
+
- [oracle] avoid CREATE DDL failure when BLOB has length specified
|
49
|
+
- [jdbc-] review autoloading backwards-incompatible change in jdbc- gems
|
50
|
+
auto-load (backwards-compat) can be enabled back using jdbc.driver.autoload
|
51
|
+
system property or using the driver specific autoload option as well
|
52
|
+
- [jdbc-] Update version handling introduce DRIVER_VERSION constant
|
53
|
+
- [oracle] should support WITH statements (as SELECTs)
|
54
|
+
- expose select? and insert? helpers on JdbcAdapter class
|
55
|
+
- [postgres] bug in create_database without options (#306)
|
56
|
+
- [db2] correct DB2 schema selection (when as400 url has parameters)
|
57
|
+
- [db2] DB2 becomes a first-class citizen (adapter) `adapter: db2`
|
58
|
+
- [h2] [hsqldb] explain support for H2 and HSQLDB
|
59
|
+
- [db2] column should be checked if ain't nil when quoting on DB2
|
60
|
+
- [mssql] raise exception when offset is specified but limit is not
|
61
|
+
- [sqlite3] SQLite3 explain support (Rails style)
|
62
|
+
- [postgres] (re-usable) explain support for PostgreSQL (based on Rails)
|
63
|
+
- [h2] update handling of time fields on H2/HSQLDB (#252)
|
64
|
+
- rescue (and wrap) only SQLExceptions from driver.connect this caused
|
65
|
+
swallowing of runtime exceptions from JDBC drivers
|
66
|
+
- support for setting (custom) jdbc driver properties in config
|
67
|
+
- when a new adapter (constant) gets loaded column types should pick it up
|
68
|
+
- [jdbc-derby] updated to 10.8.3.0
|
69
|
+
- raise LoadError with explanation on with jTDS 1.3.0 on non Java 1.7
|
70
|
+
- setup the connection methods when adapter is loaded (broken in 1.2.5)
|
71
|
+
|
72
|
+
== 1.2.5 (01/02/13)
|
73
|
+
|
74
|
+
- backwards compat with older jdbc- (driver) gems (#279)
|
75
|
+
- no need to set the :driver for jndi config (did not work anyways) when jdbc is being
|
76
|
+
configured + do not raise if there's a :driver_instance setup instead of the :driver
|
77
|
+
- support extra options with recreate_database (for postgres)
|
78
|
+
- [jdbc-derby] update Derby to 10.8.2.2
|
79
|
+
- [jdbc-h2] update H2 to 1.3.170
|
80
|
+
- no need for poluting Kernel (#jdbc_require_driver) anymore
|
81
|
+
- [sqlite3] updated sqlite3 binary handling
|
82
|
+
- [jdbc-jtds] upgrade to jtds (driver) 1.3.0
|
83
|
+
- JDBC driver names should be on one (re-usable) place
|
84
|
+
- make sure that (jdbc-xxx gem) .jars are only loaded (required) when first connection
|
85
|
+
is attempted (this avoids e.g. sqlite-jdbc.jar being always among loaded features)
|
86
|
+
- jdbc-* gems should expose the driver_jar instead of (auto) loading it
|
87
|
+
- [oracle] adding in_clause_limit override to properly handle Oracle's 1000 entry limit
|
88
|
+
- [jdbc-mysql] upgrade to mysql connector 5.1.22
|
89
|
+
- [jdbc-postgres] upgade to postgresql-9.2 jar version 9.2-1002
|
90
|
+
- [postgres] fix standard_conforming_strings's default not being set and
|
91
|
+
backslash escaping to account for standard_conforming_strings
|
92
|
+
- [jdbc-postgres] upgrade to postgres.jar 9.1.903 driver
|
93
|
+
- [jdbc-h2] update h2.jar to 1.3.168
|
94
|
+
- [postgres] use newer hex-encoding for postgresql >= 9.0
|
95
|
+
- [postgres] use updated postgres string escaping for byte arrays
|
96
|
+
- [hsqldb] fix binary data quoting
|
97
|
+
- [jdbc-hsqldb] update hsqldb.jar to 2.2.9
|
98
|
+
- [db2] if guessing the date or time fails return the value
|
99
|
+
- [db2] fix crasher regression on dump of primary keys
|
100
|
+
- [db2] fix change_column always executing as as400
|
101
|
+
- [db2] add support for primary keys to structure_dump
|
102
|
+
- [db2] detect identity columns in db2 structure_dump
|
103
|
+
- [mysql] added support for Rails 3.2 explain feature (#159)
|
104
|
+
- add support for DB_STRUCTURE in db:structure:dump
|
105
|
+
(and db:structure:load task) (#203)
|
106
|
+
- [postgres] rename sequence during table rename
|
107
|
+
- [db2] iseries returns date with two digit year - leave it as string
|
108
|
+
- [mssql] fix pessimistic locking
|
109
|
+
- [mssql] fix row_number errors on SQL Server 2000
|
110
|
+
- [db2] support WITH statements in select
|
111
|
+
- [db2] use DECIMAL(1) for boolean fields
|
112
|
+
- [db2] fetch a sequence value manually for tables with no identity columns
|
113
|
+
- [postgres] add support for template in PostgreSQLAdapter
|
114
|
+
- [db2] add recognition of MQTs and ALIASes as table types for DB2
|
115
|
+
- [postgres] remove count distinct restriction to match native ruby adapter
|
116
|
+
- [mssql] pull back primary key using table name via AR
|
117
|
+
- [db2] return nil if using jndi and schema/user is not set
|
118
|
+
- fixed support for AR 3.2.1
|
119
|
+
- [postgres] implemented dynamic search path management
|
120
|
+
|
121
|
+
== 1.2.2.1 (10/18/12)
|
122
|
+
|
123
|
+
- [postgresql] fix regression on insert for Rails 2.3 (#173)
|
124
|
+
|
1
125
|
== 1.2.2 (01/27/12)
|
2
126
|
|
3
127
|
- Thanks George Murphy and Dwayne Litzenberger for their significant
|
@@ -234,7 +358,7 @@
|
|
234
358
|
- ACTIVERECORD_JDBC-97: Dont use Rails 3 deprecated constants (David
|
235
359
|
Calavera)
|
236
360
|
- Updates for rake db:schema:dump compatibility with Rails 2.3+ and
|
237
|
-
MySQL (Joakim Kolsj�)
|
361
|
+
MySQL (Joakim Kolsj�)
|
238
362
|
- Rails 3.0.0.beta2 compatibility
|
239
363
|
- Return of Derby, H2, Hsqldb support (requires AR >= 3.0.0.beta2)
|
240
364
|
|
@@ -325,7 +449,7 @@
|
|
325
449
|
actual maximum size of the JNDI connection pool. (We'll look at how
|
326
450
|
to eliminate the need to configure AR's pool in the future.)
|
327
451
|
- NEW! Informix support courtesy of Javier Fernandez-Ivern.
|
328
|
-
- Backport another Oracle CLOB issue, thanks Edson C�sar.
|
452
|
+
- Backport another Oracle CLOB issue, thanks Edson C�sar.
|
329
453
|
- Rubyforge #22018: chomp final trailing semicolon for oracle
|
330
454
|
- JRUBY-2848: Fix NPE error in set_native_database_types
|
331
455
|
- Rework oracle lob saving callback to be Rails 2.1 friendly (assist
|
data/README.md
ADDED
@@ -0,0 +1,246 @@
|
|
1
|
+
# ActiveRecord JDBC Adapter
|
2
|
+
|
3
|
+
ActiveRecord-JDBC-Adapter (AR-JDBC) is a database adapter for Rails'
|
4
|
+
*ActiveRecord* component that can be used with [JRuby][0]. It allows use of
|
5
|
+
virtually any JDBC-compliant database with your JRuby on Rails application.
|
6
|
+
|
7
|
+
AR-JDBC **1.2.x** officially supports ActiveRecord 3.x as well as 2.3, it's
|
8
|
+
latest version is compatible with JRuby 1.6.8+ (but as always we recommend to
|
9
|
+
use the latest and greatest of JRubies) thus requires Java 1.6 at minimum.
|
10
|
+
|
11
|
+
## Databases
|
12
|
+
|
13
|
+
ActiveRecord-JDBC-Adapter provides full or nearly full support for:
|
14
|
+
**MySQL**, **PostgreSQL**, **SQLite3**, **Oracle**, **Microsoft SQL Server**,
|
15
|
+
**DB2**, **FireBird**, **Derby**, **HSQLDB**, **H2**, and **Informix**.
|
16
|
+
|
17
|
+
Other databases will require testing and likely a custom configuration module.
|
18
|
+
Please join the JRuby [mailing list][1] to help us discover support for more
|
19
|
+
databases.
|
20
|
+
|
21
|
+
## Using ActiveRecord JDBC
|
22
|
+
|
23
|
+
### Inside Rails
|
24
|
+
|
25
|
+
To use `activerecord-jdbc-adapter` with JRuby on Rails :
|
26
|
+
|
27
|
+
1. Choose the adapter you wish to gem install. The following pre-packaged
|
28
|
+
adapters are available :
|
29
|
+
|
30
|
+
- Base JDBC (`activerecord-jdbc-adapter`) - supports all available databases via
|
31
|
+
JDBC, but requires you to download and manually setup the database vendor's
|
32
|
+
JDBC driver .jar file.
|
33
|
+
- MySQL (`activerecord-jdbcmysql-adapter`)
|
34
|
+
- PostgreSQL (`activerecord-jdbcpostgresql-adapter`)
|
35
|
+
- SQLite3 (`activerecord-jdbcsqlite3-adapter`)
|
36
|
+
- Derby (`activerecord-jdbcderby-adapter`)
|
37
|
+
- HSQLDB (`activerecord-jdbchsqldb-adapter`)
|
38
|
+
- H2 (`activerecord-jdbch2-adapter`)
|
39
|
+
- MSSQL (`activerecord-jdbcmssql-adapter`) - does not support SQL Azure by default,
|
40
|
+
see the [README][2] for more information.
|
41
|
+
|
42
|
+
2a. For Rails 3, if you're generating a new application, use the
|
43
|
+
following command to generate your application:
|
44
|
+
|
45
|
+
jruby -S rails new sweetapp
|
46
|
+
|
47
|
+
2b. Otherwise, you might need to perform some extra configuration steps
|
48
|
+
to prepare your Rails application for JDBC.
|
49
|
+
|
50
|
+
If you're using Rails 3, you'll need to modify your *Gemfile* to use the
|
51
|
+
*activerecord-jdbc-adapter* gem under JRuby. Change your *Gemfile* to look
|
52
|
+
like the following (using sqlite3 as an example) :
|
53
|
+
|
54
|
+
```ruby
|
55
|
+
gem 'sqlite3', :platform => :ruby
|
56
|
+
|
57
|
+
platforms :jruby do
|
58
|
+
gem 'jruby-openssl'
|
59
|
+
gem 'activerecord-jdbcsqlite3-adapter'
|
60
|
+
end
|
61
|
+
```
|
62
|
+
|
63
|
+
If you're using Rails 2:
|
64
|
+
|
65
|
+
jruby script/generate jdbc
|
66
|
+
|
67
|
+
3. Configure your *database.yml* in the normal Rails style.
|
68
|
+
|
69
|
+
Legacy configuration: If you use one of the convenience
|
70
|
+
*activerecord-jdbcXXX-adapter* adapters, you can still put a 'jdbc'
|
71
|
+
prefix in front of the database adapter name e.g. :
|
72
|
+
|
73
|
+
```yml
|
74
|
+
development:
|
75
|
+
adapter: jdbcmysql
|
76
|
+
username: blog
|
77
|
+
password:
|
78
|
+
host: localhost
|
79
|
+
database: weblog_development
|
80
|
+
```
|
81
|
+
|
82
|
+
For plain JDBC database configurations, you'll need to know the database driver
|
83
|
+
class and URL (do not forget to put the driver jar on the class-path) e.g. :
|
84
|
+
|
85
|
+
```yml
|
86
|
+
development:
|
87
|
+
adapter: jdbc
|
88
|
+
username: blog
|
89
|
+
password:
|
90
|
+
driver: com.mysql.jdbc.Driver
|
91
|
+
url: jdbc:mysql://localhost:3306/weblog_development
|
92
|
+
```
|
93
|
+
|
94
|
+
For JNDI data sources, you may simply specify the JNDI location as follows (the
|
95
|
+
correct adapter type will be automatically detected) :
|
96
|
+
|
97
|
+
```yml
|
98
|
+
production:
|
99
|
+
adapter: jdbc
|
100
|
+
jndi: jdbc/mysqldb
|
101
|
+
```
|
102
|
+
|
103
|
+
JDBC driver specific properties might be set if you use an URL to specify the DB
|
104
|
+
or using the *properties:* syntax (since AR-JDBC **1.2.6**) :
|
105
|
+
|
106
|
+
```yml
|
107
|
+
production:
|
108
|
+
adapter: mysql
|
109
|
+
username: blog
|
110
|
+
password: blog
|
111
|
+
url: "jdbc:mysql://localhost:3306/weblog?profileSQL=true"
|
112
|
+
properties: # specific to com.mysql.jdbc.Driver
|
113
|
+
socketTimeout: 60000
|
114
|
+
connectTimeout: 60000
|
115
|
+
```
|
116
|
+
|
117
|
+
If you're really old school you might want to use AR-JDBC with a DB2 on z/OS :
|
118
|
+
|
119
|
+
```yml
|
120
|
+
development:
|
121
|
+
adapter: jdbc
|
122
|
+
encoding: unicode
|
123
|
+
url: jdbc:db2j:net://mightyzoshost:446/RAILS_DBT1
|
124
|
+
driver: com.ibm.db2.jcc.DB2Driver
|
125
|
+
schema: DB2XB12
|
126
|
+
database: RAILS_DB1
|
127
|
+
tablespace: TSDE911
|
128
|
+
lob_tablespaces:
|
129
|
+
first_table: TSDE912
|
130
|
+
username: scott
|
131
|
+
password: lion
|
132
|
+
```
|
133
|
+
|
134
|
+
### Standalone (with ActiveRecord)
|
135
|
+
|
136
|
+
1. Install the gem with JRuby:
|
137
|
+
|
138
|
+
jruby -S gem install activerecord-jdbc-adapter
|
139
|
+
|
140
|
+
If you wish to use the adapter for a specific database, you can install it
|
141
|
+
directly and the driver gem (dependency) will be installed as well :
|
142
|
+
|
143
|
+
jruby -S gem install activerecord-jdbcderby-adapter
|
144
|
+
|
145
|
+
2. After this you can establish a JDBC connection like this :
|
146
|
+
|
147
|
+
```ruby
|
148
|
+
ActiveRecord::Base.establish_connection(
|
149
|
+
:adapter => 'derby', # or 'jdbcderby'
|
150
|
+
:database => "db/my-database"
|
151
|
+
)
|
152
|
+
```
|
153
|
+
|
154
|
+
or like (but requires that you manually put the driver jar on the classpath) :
|
155
|
+
|
156
|
+
```ruby
|
157
|
+
ActiveRecord::Base.establish_connection(
|
158
|
+
:adapter => 'jdbc',
|
159
|
+
:driver => 'org.apache.derby.jdbc.EmbeddedDriver',
|
160
|
+
:url => 'jdbc:derby:sample_db;create=true'
|
161
|
+
)
|
162
|
+
```
|
163
|
+
|
164
|
+
## Source
|
165
|
+
|
166
|
+
The source for activerecord-jdbc-adapter is available using git :
|
167
|
+
|
168
|
+
git clone git://github.com/jruby/activerecord-jdbc-adapter.git
|
169
|
+
|
170
|
+
Please note that the project manages multiple gems from a single repository,
|
171
|
+
if you're using *Bundler* 1.2 it should be able to locate all gemspecs from
|
172
|
+
the git repository. Sample *Gemfile* for running with (MySQL) master :
|
173
|
+
|
174
|
+
```ruby
|
175
|
+
gem 'activerecord-jdbc-adapter', :github => 'jruby/activerecord-jdbc-adapter'
|
176
|
+
gem 'activerecord-jdbcmysql-adapter', :github => 'jruby/activerecord-jdbc-adapter'
|
177
|
+
gem 'jdbc-mysql', :github => 'jruby/activerecord-jdbc-adapter'
|
178
|
+
```
|
179
|
+
|
180
|
+
## Running AR-JDBC Tests
|
181
|
+
|
182
|
+
[![Build Status][9]](http://travis-ci.org/#!/jruby/activerecord-jdbc-adapter)
|
183
|
+
|
184
|
+
Drivers for 6 open-source databases are included. Provided you have
|
185
|
+
MySQL installed, you can simply type `jruby -S rake` to run the tests.
|
186
|
+
A database named *weblog_development* is needed beforehand with a
|
187
|
+
connection user of "blog" and an empty password. You alse need to grant
|
188
|
+
"blog" create privileges on 'test_rake_db_create.*'.
|
189
|
+
|
190
|
+
If you also have PostgreSQL available, those tests will be run if the
|
191
|
+
`psql` executable can be found. Also ensure you have a database named
|
192
|
+
*weblog_development* and a user named "blog" with an empty password.
|
193
|
+
You can control the host and port the tests will attempt to by setting
|
194
|
+
the environment variables `PGHOST` and `PGPORT`.
|
195
|
+
|
196
|
+
To execute a single test case, you can run:
|
197
|
+
|
198
|
+
rake appraisal:{version} test_{db} TEST=test/{tests_file}
|
199
|
+
|
200
|
+
Substitute the *version* of ActiveRecord for version, which can be one of :
|
201
|
+
*rails23*, *rails30*, *rails31*, or *rails32*.
|
202
|
+
|
203
|
+
The db can be one of these : *sqlite3*, *mysql*, *postgres*,
|
204
|
+
*mssql*, *sybase*, *oracle*, *db2*, *derby*, *h2* or *hssql*.
|
205
|
+
|
206
|
+
Finally, the *tests_file* will be whichever (.rb) test case you want to run.
|
207
|
+
|
208
|
+
### Running AR Tests
|
209
|
+
|
210
|
+
To run the current AR-JDBC sources with `ActiveRecord`, just use the included
|
211
|
+
`rails:test` task. Be sure to specify a driver and a path to the AR's sources :
|
212
|
+
|
213
|
+
jruby -S rake rails:test DRIVER=mysql RAILS=/path/rails_source_dir
|
214
|
+
|
215
|
+
## Extending AR-JDBC
|
216
|
+
|
217
|
+
You can create your own extension to AR-JDBC for a JDBC-based database
|
218
|
+
that core AR-JDBC does not support. We've created an example project
|
219
|
+
for the Intersystems Cache database that you can examine as a template.
|
220
|
+
See the [cachedb-adapter project][4] for more information.
|
221
|
+
|
222
|
+
## Feedback
|
223
|
+
|
224
|
+
Please report bugs at our [issue tracker][3]. If you're not sure if
|
225
|
+
something's a bug, feel free to pre-report it on the [mailing lists][1] or
|
226
|
+
ask on the #JRuby IRC channel on http://freenode.net/.
|
227
|
+
|
228
|
+
## Authors
|
229
|
+
|
230
|
+
This project was written by Nick Sieger <nick@nicksieger.com> and Ola Bini
|
231
|
+
<olabini@gmail.com> with lots of help from the JRuby community.
|
232
|
+
|
233
|
+
## License
|
234
|
+
|
235
|
+
ActiveRecord-JDBC-Adapter is released under the BSD/MIT license.
|
236
|
+
See the LICENSE.txt file included with the distribution for details.
|
237
|
+
|
238
|
+
Open-source driver gems within AR-JDBC's sources are licensed under the same
|
239
|
+
license the database's drivers are licensed. See each driver gem's LICENSE.txt.
|
240
|
+
|
241
|
+
[0]: http://www.jruby.org/
|
242
|
+
[1]: http://jruby.org/community
|
243
|
+
[2]: http://github.com/jruby/activerecord-jdbc-adapter/blob/master/activerecord-jdbcmssql-adapter
|
244
|
+
[3]: https://github.com/jruby/activerecord-jdbc-adapter/issues
|
245
|
+
[4]: http://github.com/nicksieger/activerecord-cachedb-adapter
|
246
|
+
[9]: https://secure.travis-ci.org/jruby/activerecord-jdbc-adapter.png
|