activerecord-jdbc-alt-adapter 52.2.3-java → 60.1.0-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/.travis.yml +80 -52
- data/Gemfile +10 -3
- data/README.md +55 -37
- data/Rakefile +31 -5
- data/Rakefile.jdbc +8 -1
- data/activerecord-jdbc-adapter.gemspec +6 -9
- data/activerecord-jdbc-alt-adapter.gemspec +6 -9
- data/lib/arel/visitors/sqlserver.rb +33 -23
- data/lib/arjdbc/abstract/connection_management.rb +7 -0
- data/lib/arjdbc/abstract/core.rb +17 -24
- data/lib/arjdbc/abstract/database_statements.rb +31 -20
- data/lib/arjdbc/abstract/statement_cache.rb +2 -5
- data/lib/arjdbc/abstract/transaction_support.rb +5 -3
- data/lib/arjdbc/db2/column.rb +0 -39
- data/lib/arjdbc/derby/adapter.rb +1 -20
- data/lib/arjdbc/firebird/adapter.rb +0 -21
- data/lib/arjdbc/h2/adapter.rb +0 -15
- data/lib/arjdbc/hsqldb/adapter.rb +0 -14
- data/lib/arjdbc/informix/adapter.rb +0 -23
- data/lib/arjdbc/jdbc.rb +0 -4
- data/lib/arjdbc/jdbc/adapter.rb +3 -1
- data/lib/arjdbc/jdbc/adapter_require.rb +3 -1
- data/lib/arjdbc/jdbc/base_ext.rb +3 -1
- data/lib/arjdbc/jdbc/callbacks.rb +2 -0
- data/lib/arjdbc/jdbc/column.rb +3 -5
- data/lib/arjdbc/jdbc/connection.rb +2 -0
- data/lib/arjdbc/jdbc/connection_methods.rb +2 -0
- data/lib/arjdbc/jdbc/error.rb +2 -0
- data/lib/arjdbc/jdbc/extension.rb +2 -0
- data/lib/arjdbc/jdbc/java.rb +3 -1
- data/lib/arjdbc/jdbc/railtie.rb +3 -1
- data/lib/arjdbc/jdbc/rake_tasks.rb +3 -1
- data/lib/arjdbc/jdbc/serialized_attributes_helper.rb +3 -1
- data/lib/arjdbc/jdbc/type_cast.rb +2 -0
- data/lib/arjdbc/jdbc/type_converter.rb +2 -0
- data/lib/arjdbc/mssql.rb +3 -1
- data/lib/arjdbc/mssql/adapter.rb +112 -46
- data/lib/arjdbc/mssql/column.rb +5 -1
- data/lib/arjdbc/mssql/connection_methods.rb +13 -2
- data/lib/arjdbc/mssql/database_limits.rb +2 -0
- data/lib/arjdbc/mssql/database_statements.rb +44 -6
- data/lib/arjdbc/mssql/errors.rb +2 -0
- data/lib/arjdbc/mssql/explain_support.rb +3 -1
- data/lib/arjdbc/mssql/extensions/attribute_methods.rb +5 -1
- data/lib/arjdbc/mssql/extensions/calculations.rb +2 -0
- data/lib/arjdbc/mssql/quoting.rb +38 -0
- data/lib/arjdbc/mssql/schema_creation.rb +24 -2
- data/lib/arjdbc/mssql/schema_definitions.rb +10 -0
- data/lib/arjdbc/mssql/schema_dumper.rb +2 -0
- data/lib/arjdbc/mssql/schema_statements.rb +63 -21
- data/lib/arjdbc/mssql/transaction.rb +2 -0
- data/lib/arjdbc/mssql/types.rb +2 -0
- data/lib/arjdbc/mssql/types/binary_types.rb +2 -0
- data/lib/arjdbc/mssql/types/date_and_time_types.rb +2 -0
- data/lib/arjdbc/mssql/types/deprecated_types.rb +2 -0
- data/lib/arjdbc/mssql/types/numeric_types.rb +2 -0
- data/lib/arjdbc/mssql/types/string_types.rb +2 -0
- data/lib/arjdbc/mssql/utils.rb +2 -0
- data/lib/arjdbc/mysql/adapter.rb +47 -18
- data/lib/arjdbc/mysql/connection_methods.rb +13 -7
- data/lib/arjdbc/postgresql/adapter.rb +240 -214
- data/lib/arjdbc/postgresql/base/array_decoder.rb +2 -0
- data/lib/arjdbc/postgresql/base/array_encoder.rb +4 -2
- data/lib/arjdbc/postgresql/base/array_parser.rb +4 -2
- data/lib/arjdbc/postgresql/base/pgconn.rb +2 -0
- data/lib/arjdbc/postgresql/column.rb +11 -6
- data/lib/arjdbc/postgresql/connection_methods.rb +3 -1
- data/lib/arjdbc/postgresql/name.rb +2 -0
- data/lib/arjdbc/postgresql/oid_types.rb +3 -1
- data/lib/arjdbc/sqlite3/adapter.rb +188 -180
- data/lib/arjdbc/sqlite3/connection_methods.rb +16 -4
- data/lib/arjdbc/tasks/databases.rake +13 -10
- data/lib/arjdbc/tasks/mssql_database_tasks.rb +49 -5
- data/lib/arjdbc/util/quoted_cache.rb +3 -1
- data/lib/arjdbc/util/serialized_attributes.rb +3 -1
- data/lib/arjdbc/util/table_copier.rb +3 -1
- data/lib/arjdbc/version.rb +1 -1
- data/pom.xml +4 -4
- data/rakelib/01-tomcat.rake +2 -2
- data/rakelib/02-test.rake +0 -2
- data/rakelib/rails.rake +1 -1
- data/src/java/arjdbc/ArJdbcModule.java +5 -5
- data/src/java/arjdbc/jdbc/DriverWrapper.java +1 -9
- data/src/java/arjdbc/jdbc/RubyJdbcConnection.java +468 -637
- data/src/java/arjdbc/mssql/MSSQLRubyJdbcConnection.java +319 -38
- data/src/java/arjdbc/mysql/MySQLRubyJdbcConnection.java +13 -23
- data/src/java/arjdbc/postgresql/PostgreSQLRubyJdbcConnection.java +44 -31
- data/src/java/arjdbc/sqlite3/SQLite3RubyJdbcConnection.java +94 -99
- data/src/java/arjdbc/util/DateTimeUtils.java +34 -12
- metadata +7 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f83a5e387ec9999cc730027498dec97428cfee7b3c3edcc6845a779c01c4272a
|
4
|
+
data.tar.gz: 3a7e9ce2b8e6e968bdb21f4ac72a9f498e3226c414ec4b003e4b463dffc74062
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f71a50d80a6f01837512d87a52ef32ec69a245e1927086cc0736efa35835c57710652f1ad6c294039422ad69eea20d308b48df02ba8d43e7c1acea4de7358ee0
|
7
|
+
data.tar.gz: 732cde407f1c4ff98bb7e528ea183dd483e2b8edf8a475f60f445dc7580fd8e8d3374ca248b5d7eb2f02b1c596efdeed5ce7dc393563425565657ca6302d6145
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -1,18 +1,25 @@
|
|
1
|
-
language: ruby
|
2
1
|
sudo: false
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
-
|
7
|
-
|
8
|
-
- /maintenance|support/
|
9
|
-
- /.*dev$/
|
10
|
-
bundler_args: --without development
|
11
|
-
script: bundle exec rake ${TEST_PREFIX}test_$DB
|
2
|
+
dist: xenial
|
3
|
+
|
4
|
+
services:
|
5
|
+
- mysql
|
6
|
+
|
12
7
|
before_install:
|
13
8
|
- unset _JAVA_OPTIONS
|
14
9
|
- rvm @default,@global do gem uninstall bundler -a -x -I || true
|
15
10
|
- gem install bundler -v "~>1.17.3"
|
11
|
+
install:
|
12
|
+
- bundle install --retry 3 --without development
|
13
|
+
# to fix this issue: https://travis-ci.community/t/mariadb-10-1-fails-to-install-on-xenial/3151/3
|
14
|
+
- mysql -u root -e 'CREATE USER IF NOT EXISTS travis@localhost; GRANT ALL ON *.* TO travis@localhost;' || true
|
15
|
+
|
16
|
+
language: ruby
|
17
|
+
rvm:
|
18
|
+
- jruby-9.2.7.0
|
19
|
+
jdk:
|
20
|
+
- openjdk8
|
21
|
+
|
22
|
+
script: bundle exec rake ${TEST_PREFIX}test_$DB
|
16
23
|
before_script:
|
17
24
|
- echo "JAVA_OPTS=$JAVA_OPTS"
|
18
25
|
- export JRUBY_OPTS="-J-Xms64M -J-Xmx1024M"
|
@@ -38,63 +45,84 @@ before_script:
|
|
38
45
|
psql -c "create database activerecord_unittest;" -U postgres && \
|
39
46
|
psql -c "create database activerecord_unittest2;" -U postgres \
|
40
47
|
|| true
|
41
|
-
|
42
|
-
- jruby-9.1.16.0
|
43
|
-
jdk:
|
44
|
-
- openjdk8
|
45
|
-
addons:
|
46
|
-
postgresql: "9.4"
|
48
|
+
|
47
49
|
env:
|
48
|
-
|
49
|
-
|
50
|
-
- DB=mysql2 DRIVER=MariaDB
|
51
|
-
- DB=postgresql PREPARED_STATEMENTS=false INSERT_RETURNING=false
|
52
|
-
- DB=postgresql PREPARED_STATEMENTS=false INSERT_RETURNING=true
|
53
|
-
- DB=postgresql PREPARED_STATEMENTS=true
|
54
|
-
- DB=postgresql PREPARED_STATEMENTS=true INSERT_RETURNING=true
|
55
|
-
- DB=sqlite3 PREPARED_STATEMENTS=false
|
56
|
-
- DB=sqlite3 PREPARED_STATEMENTS=true
|
57
|
-
- DB=jndi PREPARED_STATEMENTS=false
|
58
|
-
- DB=jndi PREPARED_STATEMENTS=true
|
50
|
+
global:
|
51
|
+
- AR_VERSION="6-0-stable"
|
59
52
|
matrix:
|
60
53
|
allow_failures:
|
61
54
|
- rvm: jruby-head
|
62
55
|
include:
|
63
|
-
|
64
|
-
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
env: DB=
|
70
|
-
|
71
|
-
|
72
|
-
env: DB=
|
73
|
-
|
74
|
-
|
75
|
-
env: DB=postgresql
|
76
|
-
|
77
|
-
|
78
|
-
env: DB=
|
79
|
-
|
56
|
+
- env: DB=mysql2 PREPARED_STATEMENTS=false
|
57
|
+
- env: DB=mysql2 PREPARED_STATEMENTS=true
|
58
|
+
- env: DB=mysql2 DRIVER=MariaDB
|
59
|
+
|
60
|
+
- addons:
|
61
|
+
postgresql: "10"
|
62
|
+
env: DB=postgresql PREPARED_STATEMENTS=false INSERT_RETURNING=false
|
63
|
+
- addons:
|
64
|
+
postgresql: "10"
|
65
|
+
env: DB=postgresql PREPARED_STATEMENTS=false INSERT_RETURNING=true
|
66
|
+
- addons:
|
67
|
+
postgresql: "10"
|
68
|
+
env: DB=postgresql PREPARED_STATEMENTS=true
|
69
|
+
- addons:
|
70
|
+
postgresql: "10"
|
71
|
+
env: DB=postgresql PREPARED_STATEMENTS=true INSERT_RETURNING=true
|
72
|
+
- addons:
|
73
|
+
postgresql: "10"
|
74
|
+
env: DB=postgresql PREPARED_STATEMENTS=true JRUBY_OPTS=-J-Duser.timezone=America/Detroit
|
75
|
+
- addons:
|
76
|
+
postgresql: "9.4"
|
77
|
+
env: DB=postgresql PREPARED_STATEMENTS=true
|
78
|
+
|
79
|
+
- env: DB=sqlite3 PREPARED_STATEMENTS=false
|
80
|
+
- env: DB=sqlite3 PREPARED_STATEMENTS=true
|
81
|
+
|
82
|
+
- env: DB=jndi PREPARED_STATEMENTS=false
|
83
|
+
- env: DB=jndi PREPARED_STATEMENTS=true
|
84
|
+
|
85
|
+
# Java 11
|
86
|
+
- env: DB=mysql2
|
87
|
+
jdk: oraclejdk11
|
88
|
+
- env: DB=postgresql
|
89
|
+
jdk: oraclejdk11
|
90
|
+
addons:
|
91
|
+
postgresql: "10"
|
92
|
+
- env: DB=sqlite3
|
93
|
+
jdk: oraclejdk11
|
94
|
+
|
80
95
|
# jruby-head
|
81
96
|
- rvm: jruby-head
|
82
97
|
env: DB=mysql2
|
83
98
|
- rvm: jruby-head
|
84
99
|
env: DB=postgresql
|
100
|
+
addons:
|
101
|
+
postgresql: "10"
|
85
102
|
- rvm: jruby-head
|
86
103
|
env: DB=sqlite3
|
104
|
+
|
87
105
|
# testing against MariaDB
|
88
106
|
- addons:
|
89
|
-
mariadb:
|
107
|
+
mariadb: 10.2
|
90
108
|
env: DB=mariadb PREPARED_STATEMENTS=false
|
91
109
|
- addons:
|
92
|
-
mariadb:
|
110
|
+
mariadb: 10.3
|
93
111
|
env: DB=mariadb PREPARED_STATEMENTS=true
|
112
|
+
|
94
113
|
# Rails test-suite :
|
95
|
-
- env: DB=mysql2 TEST_PREFIX="rails:" AR_VERSION="
|
96
|
-
- env: DB=mysql2 TEST_PREFIX="rails:" AR_VERSION="
|
97
|
-
- env: DB=mysql2 TEST_PREFIX="rails:" AR_VERSION="
|
98
|
-
|
99
|
-
-
|
100
|
-
|
114
|
+
- env: DB=mysql2 TEST_PREFIX="rails:" AR_VERSION="6-0-stable" # PS off by default
|
115
|
+
- env: DB=mysql2 TEST_PREFIX="rails:" AR_VERSION="6-0-stable" PREPARED_STATEMENTS=true
|
116
|
+
- env: DB=mysql2 TEST_PREFIX="rails:" AR_VERSION="6-0-stable" DRIVER=MariaDB
|
117
|
+
|
118
|
+
- addons:
|
119
|
+
postgresql: "10"
|
120
|
+
env: DB=postgresql TEST_PREFIX="rails:" AR_VERSION="6-0-stable" # PS on by default
|
121
|
+
- addons:
|
122
|
+
postgresql: "10"
|
123
|
+
env: DB=postgresql TEST_PREFIX="rails:" AR_VERSION="6-0-stable" PREPARED_STATEMENTS=false
|
124
|
+
- addons:
|
125
|
+
postgresql: "9.4"
|
126
|
+
env: DB=postgresql TEST_PREFIX="rails:" AR_VERSION="6-0-stable" # PS on by default
|
127
|
+
|
128
|
+
- env: DB=sqlite3 TEST_PREFIX="rails:" AR_VERSION="6-0-stable"
|
data/Gemfile
CHANGED
@@ -10,10 +10,15 @@ if ENV['RAILS'] # Use local clone of Rails
|
|
10
10
|
|
11
11
|
activemodel_dir = ::File.join(rails_dir, 'activemodel')
|
12
12
|
activesupport_dir = ::File.join(rails_dir, 'activesupport')
|
13
|
-
|
13
|
+
actionpack_dir = ::File.join(rails_dir, 'actionpack')
|
14
|
+
actionview_dir = ::File.join(rails_dir, 'actionview')
|
15
|
+
|
14
16
|
gem 'activerecord', require: false, path: activerecord_dir
|
15
17
|
gem 'activemodel', require: false, path: activemodel_dir
|
16
18
|
gem 'activesupport', require: false, path: activesupport_dir
|
19
|
+
gem 'actionpack', require: false, path: actionpack_dir
|
20
|
+
gem 'actionview', require: false, path: actionview_dir
|
21
|
+
|
17
22
|
elsif ENV['AR_VERSION'] # Use specific version of AR and not .gemspec version
|
18
23
|
version = ENV['AR_VERSION']
|
19
24
|
|
@@ -28,11 +33,13 @@ elsif ENV['AR_VERSION'] # Use specific version of AR and not .gemspec version
|
|
28
33
|
else # branch
|
29
34
|
opts = {branch: version}
|
30
35
|
end
|
31
|
-
|
36
|
+
|
32
37
|
git 'https://github.com/rails/rails.git', **opts do
|
33
38
|
gem 'activerecord', require: false
|
34
39
|
gem 'activemodel', require: false
|
35
40
|
gem 'activesupport', require: false
|
41
|
+
gem 'actionpack', require: false
|
42
|
+
gem 'actionview', require: false
|
36
43
|
end
|
37
44
|
end
|
38
45
|
end
|
@@ -48,7 +55,7 @@ group :test do
|
|
48
55
|
gem 'mocha', '~> 1.2', require: false # Rails has '~> 0.14'
|
49
56
|
|
50
57
|
gem 'bcrypt', '~> 3.1.11', require: false
|
51
|
-
gem 'jdbc-mssql', '~> 0.
|
58
|
+
gem 'jdbc-mssql', '~> 0.9.0', require: nil
|
52
59
|
# gem 'pry-debugger-jruby', platform: :jruby
|
53
60
|
end
|
54
61
|
|
data/README.md
CHANGED
@@ -6,16 +6,20 @@ supported by the original adapter such as PostgreSQL but it is advised to
|
|
6
6
|
use the [original adapter](https://github.com/jruby/active)
|
7
7
|
|
8
8
|
This adapter only works with JRuby and it is advised to install the latest
|
9
|
-
stable
|
9
|
+
stable of this adapter and Rails
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
| Gem Version | Rails Version | min JRuby |
|
12
|
+
| ----------- | ------------- | --------- |
|
13
|
+
| 50.6.1 | 5.0.7.2 | 9.1.x |
|
14
|
+
| 51.6.1 | 5.1.7 | 9.1.x |
|
15
|
+
| 52.5.1 | 5.2.4.1 | 9.1.x |
|
16
|
+
| 60.0.0 | 6.0.2 | 9.2.9 |
|
16
17
|
|
17
18
|
This adapter passes most of the Rails tests (ActiveRecord tests) with the
|
18
|
-
exception of some test that are not compatible with the SQL Server
|
19
|
+
exception of some test that are not compatible with the SQL Server. To run
|
20
|
+
the test use the following fork [Rails](https://github.com/JesseChavez/rails/tree/6-0-stable-dev),
|
21
|
+
and the instructions in file `RUNNING_TESTS.md`. The fork has some
|
22
|
+
schema tweaks to make it compatible with SQL Server.
|
19
23
|
|
20
24
|
### How to use it:
|
21
25
|
|
@@ -24,13 +28,17 @@ Add the following to your `Gemfile`:
|
|
24
28
|
```ruby
|
25
29
|
platforms :jruby do
|
26
30
|
# Use jdbc as the database for Active Record
|
27
|
-
gem 'activerecord-jdbc-alt-adapter', '~>
|
28
|
-
gem 'jdbc-mssql', '~> 0.
|
31
|
+
gem 'activerecord-jdbc-alt-adapter', '~> 60.0.0'
|
32
|
+
gem 'jdbc-mssql', '~> 0.7.0'
|
29
33
|
end
|
30
34
|
```
|
31
35
|
|
32
|
-
Or look at the sample rails
|
33
|
-
|
36
|
+
Or look at the sample rails and see how is set up:
|
37
|
+
|
38
|
+
- Rails 6.0 sample app [wombat60](https://github.com/JesseChavez/wombat60)
|
39
|
+
|
40
|
+
- Old rails 5.0 app [wombat50](https://github.com/JesseChavez/wombat50)
|
41
|
+
|
34
42
|
|
35
43
|
### Breaking changes
|
36
44
|
|
@@ -102,14 +110,6 @@ production:
|
|
102
110
|
```
|
103
111
|
|
104
112
|
|
105
|
-
### NOTE
|
106
|
-
|
107
|
-
Keep one eye in the Rails connection pool, we have not thoroughly tested that
|
108
|
-
part since we don't use the default Rails connection pool, other than that
|
109
|
-
this adapter should just work.
|
110
|
-
|
111
|
-
|
112
|
-
|
113
113
|
# ActiveRecord JDBC Adapter
|
114
114
|
|
115
115
|
[][7]
|
@@ -117,27 +117,28 @@ this adapter should just work.
|
|
117
117
|
ActiveRecord-JDBC-Adapter (AR-JDBC) is the main database adapter for Rails'
|
118
118
|
*ActiveRecord* component that can be used with [JRuby][0].
|
119
119
|
ActiveRecord-JDBC-Adapter provides full or nearly full support for:
|
120
|
-
**MySQL**, **PostgreSQL**, **SQLite3
|
121
|
-
add support **MSSQL**. Unless we get more contributions we will not be going
|
122
|
-
beyond these four adapters. Note that the amount of work needed to get
|
123
|
-
another adapter is not huge but the amount of testing required to make sure
|
124
|
-
that adapter continues to work is not something we can do with the resources
|
125
|
-
we currently have.
|
120
|
+
**MySQL**, **PostgreSQL**, **SQLite3** and **MSSQL*** (SQLServer).
|
126
121
|
|
127
|
-
|
128
|
-
|
122
|
+
Unless we get more contributions we will not be supporting more adapters.
|
123
|
+
Note that the amount of work needed to get another adapter is not huge but
|
124
|
+
the amount of testing required to make sure that adapter continues to work
|
125
|
+
is not something we can do with the resources we currently have.
|
126
|
+
|
127
|
+
- for **Oracle** database users you are encouraged to use
|
128
|
+
https://github.com/rsim/oracle-enhanced
|
129
|
+
- **MSSQL** adapter's gem parts reside in a [separate repository][8]
|
129
130
|
|
130
131
|
Versions are targeted at certain versions of Rails and live on their own branches.
|
131
132
|
|
132
|
-
| Gem Version | Rails Version | Branch |
|
133
|
-
| ----------- | ------------- |
|
134
|
-
| 50.x | 5.0.x | 50-stable |
|
135
|
-
| 51.x | 5.1.x | 51-stable |
|
136
|
-
| 52.x | 5.2.x | 52-stable |
|
137
|
-
|
|
133
|
+
| Gem Version | Rails Version | Branch | min JRuby | min Java |
|
134
|
+
| ----------- | ------------- | --------- | --------- | -------- |
|
135
|
+
| 50.x | 5.0.x | 50-stable | 9.1.x | 7 |
|
136
|
+
| 51.x | 5.1.x | 51-stable | 9.1.x | 7 |
|
137
|
+
| 52.x | 5.2.x | 52-stable | 9.1.x | 7 |
|
138
|
+
| 60.x | 6.0.x | master | 9.2.7 | 8 |
|
138
139
|
|
139
|
-
|
140
|
-
|
140
|
+
Note that JRuby 9.1.x is end-of-life. We recommend Java 8 at a minimum for all
|
141
|
+
versions.
|
141
142
|
|
142
143
|
## Using ActiveRecord JDBC
|
143
144
|
|
@@ -151,6 +152,7 @@ adapters are available:
|
|
151
152
|
- MySQL (`activerecord-jdbcmysql-adapter`)
|
152
153
|
- PostgreSQL (`activerecord-jdbcpostgresql-adapter`)
|
153
154
|
- SQLite3 (`activerecord-jdbcsqlite3-adapter`)
|
155
|
+
- MSSQL (`activerecord-jdbcsqlserver-adapter`)
|
154
156
|
|
155
157
|
2. If you're generating a new Rails application, use the following command:
|
156
158
|
|
@@ -193,6 +195,21 @@ production:
|
|
193
195
|
connectTimeout: 60000
|
194
196
|
```
|
195
197
|
|
198
|
+
#### MySQL specific notes
|
199
|
+
|
200
|
+
Depending on the MySQL server configuration, it might be required to set
|
201
|
+
additional connection properties for date/time support to work correctly. If you
|
202
|
+
encounter problems, try adding this to your database configuration:
|
203
|
+
|
204
|
+
```yml
|
205
|
+
properties:
|
206
|
+
serverTimezone: <%= java.util.TimeZone.getDefault.getID %>
|
207
|
+
```
|
208
|
+
|
209
|
+
The correct timezone depends on the system setup, but the one shown is a good
|
210
|
+
place to start and is actually the correct setting for many systems.
|
211
|
+
|
212
|
+
|
196
213
|
### Standalone with ActiveRecord
|
197
214
|
|
198
215
|
Once the setup is made (see below) you can establish a JDBC connection like this
|
@@ -267,7 +284,8 @@ ask on the #JRuby IRC channel on http://freenode.net/ (try [web-chat][6]).
|
|
267
284
|
This project was originally written by [Nick Sieger](http://github.com/nicksieger)
|
268
285
|
and [Ola Bini](http://github.com/olabini) with lots of help from the JRuby community.
|
269
286
|
Polished 3.x compatibility and 4.x support (for AR-JDBC >= 1.3.0) was managed by
|
270
|
-
[Karol Bucek](http://github.com/kares) among others.
|
287
|
+
[Karol Bucek](http://github.com/kares) among others. Support for Rails 6 was
|
288
|
+
contributed by [shellyBits GmbH](https://shellybits.ch/)
|
271
289
|
|
272
290
|
## License
|
273
291
|
|
@@ -285,4 +303,4 @@ license the database's drivers are licensed. See each driver gem's LICENSE.txt.
|
|
285
303
|
[5]: https://github.com/jruby/activerecord-jdbc-adapter/wiki
|
286
304
|
[6]: https://webchat.freenode.net/?channels=#jruby
|
287
305
|
[7]: http://badge.fury.io/rb/activerecord-jdbc-adapter
|
288
|
-
[8]: https://github.com/jruby/activerecord-
|
306
|
+
[8]: https://github.com/jruby/activerecord-jdbcsqlserver-adapter
|
data/Rakefile
CHANGED
@@ -1,3 +1,29 @@
|
|
1
|
+
# Common usage
|
2
|
+
#
|
3
|
+
# rake build:adapters - to build all specific adapter gems and the base gem
|
4
|
+
# rake release:do - build:adapters + git tag + push gems
|
5
|
+
#
|
6
|
+
# Environment variables used by this Rakefile:
|
7
|
+
#
|
8
|
+
# INCLUDE_JAR_IN_GEM [default task - false, other taks - true]:
|
9
|
+
# Note: This is something you should not normally have to set.
|
10
|
+
# For local development we always will end up including the jar file
|
11
|
+
# in any task which generates our main gem. The wrinkle to this
|
12
|
+
# is when we do a custom github link in bundler:
|
13
|
+
#
|
14
|
+
# gem 'ar-jdbc', github: '...'
|
15
|
+
#
|
16
|
+
# Because we stopped committing a .jar file for every change and so when
|
17
|
+
# we include a gem like this it clones the repository and does a default
|
18
|
+
# build in rake. This in turn will end up forcing a compile to generate
|
19
|
+
# that jar (similar to how c-extensions compile at the time of install).
|
20
|
+
# For shipped gems we do include the jar so that people do not require
|
21
|
+
# this compile step.
|
22
|
+
#
|
23
|
+
# NOOP [release:do - false]
|
24
|
+
#
|
25
|
+
# No commands or gem pushing during a release.
|
26
|
+
|
1
27
|
require 'rake/clean'
|
2
28
|
|
3
29
|
CLEAN.include 'derby*', 'test.db.*', '*test.sqlite3', 'test/reports'
|
@@ -38,7 +64,8 @@ rake = lambda { |task| ruby "-S", "rake", task }
|
|
38
64
|
|
39
65
|
desc "Build #{gem_name} gem into the pkg directory."
|
40
66
|
task :build => :jar do
|
41
|
-
|
67
|
+
include_jar = ENV['INCLUDE_JAR_IN_GEM'] || 'true'
|
68
|
+
sh("INCLUDE_JAR_IN_GEM=#{include_jar} gem build -V '#{gemspec_path}'") do
|
42
69
|
gem_path = built_gem_path.call
|
43
70
|
file_name = File.basename(gem_path)
|
44
71
|
FileUtils.mkdir_p(File.join(base_dir, 'pkg'))
|
@@ -58,7 +85,6 @@ end
|
|
58
85
|
|
59
86
|
desc "Releasing AR-JDBC gems (use NOOP=true to disable gem pushing)"
|
60
87
|
task 'release:do' do
|
61
|
-
ENV['RELEASE'] = 'true' # so that .gemspec is built with adapter_java.jar
|
62
88
|
Rake::Task['build'].invoke
|
63
89
|
# Rake::Task['build:adapters'].invoke
|
64
90
|
|
@@ -159,7 +185,7 @@ if defined? JRUBY_VERSION
|
|
159
185
|
#directory classes = 'pkg/classes'; CLEAN << classes
|
160
186
|
|
161
187
|
file jar_file => FileList[ 'src/java/**/*.java' ] do
|
162
|
-
source = target = '1.
|
188
|
+
source = target = '1.8'; debug = true
|
163
189
|
|
164
190
|
get_driver_jars_local = lambda do |*args|
|
165
191
|
driver_deps = args.empty? ? [ :Postgres, :MySQL ] : args
|
@@ -257,7 +283,7 @@ if defined? JRUBY_VERSION
|
|
257
283
|
begin
|
258
284
|
require 'arjdbc/version'
|
259
285
|
rescue LoadError
|
260
|
-
path = File.expand_path('
|
286
|
+
path = File.expand_path('lib', File.dirname(__FILE__))
|
261
287
|
unless $LOAD_PATH.include?(path)
|
262
288
|
$LOAD_PATH << path; retry
|
263
289
|
end
|
@@ -297,7 +323,7 @@ if defined? JRUBY_VERSION
|
|
297
323
|
# class_files.gsub!('$', '\$') unless windows?
|
298
324
|
# args = class_files.map { |path| [ "-C #{classes_dir}", path ] }.flatten
|
299
325
|
|
300
|
-
if ENV['
|
326
|
+
if ENV['INCLUDE_JAR_IN_GEM'] == 'true'; require 'tempfile'
|
301
327
|
manifest = "Built-Time: #{Time.now.utc.strftime('%Y-%m-%d %H:%M:%S')}\n"
|
302
328
|
manifest += "Built-JRuby: #{JRUBY_VERSION}\n"
|
303
329
|
manifest += "Specification-Title: ActiveRecord-JDBC\n"
|