activerecord-jdbc-adapter 60.4-java → 61.2-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f062e2be5b2eac39891edc237923df53f583d50b4b71efb3f3844491aae9afb2
4
- data.tar.gz: c2275db1204292f92ff659caea1d879b32493eeffd4174c8707464dd970e8cb7
3
+ metadata.gz: aa4df302770068a233f5d07c6af210f49bddca54244ab09ecc3419ba3128918d
4
+ data.tar.gz: a1f4a473192ba55a305a8d62595fef416f00471a9d8957137966876325a25d03
5
5
  SHA512:
6
- metadata.gz: fae9211a369123d46ad498a21f4204446612e1a8a0309402ebe6b281487c56633439cda74e2bbd53b4b72a385f57cb5bb508f777f751f25793461002c91f615c
7
- data.tar.gz: c00825d782b41eb7bb803e05708a54e49049337a79c854e7cf4d29535e19819b5d6aec39d9cb473d85385f37b200fc653be560aef16b44220bff9193ca83d8f8
6
+ metadata.gz: 6d6d41aa2bcbb0e9583e2c09c7b8b46357910def331a5bf9869f1eaf95199c6797f012ac57ef58dd2d144f4c6d7d46a86f52f87e55e24d7bf5166105355f760d
7
+ data.tar.gz: 66ccf4e7075f94b6505669052f93bad576f4a6cb49ace225c049ce68a9d4302d2114352737f43bf0d8392de8c2a8ee1b28387caa2dda3e849880a7c8b82f42d6
@@ -0,0 +1,266 @@
1
+ name: Run ARJDBC and Rails tests
2
+
3
+ on:
4
+ push:
5
+ branches: [ 61-stable, master ]
6
+ pull_request:
7
+ branches: [ 61-stable, master ]
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ test-rails-mysql:
14
+
15
+ name: Rails Tests (MySQL)
16
+ runs-on: ubuntu-latest
17
+ strategy:
18
+ fail-fast: false
19
+ matrix:
20
+ ruby-version: ['jruby-9.2.20.1']
21
+ db: ['mysql2']
22
+ test_targets: ["rails:test_mysql2"]
23
+ ar_version: ["6-1-stable"]
24
+ prepared_statements: ['false', 'true']
25
+ driver: ['MySQL']
26
+
27
+ services:
28
+ mysql:
29
+ image: mysql:5.7
30
+ ports:
31
+ - 3306
32
+
33
+ env:
34
+ DB: ${{ matrix.db }}
35
+ AR_VERSION: ${{ matrix.ar_version }}
36
+ PREPARED_STATEMENTS: ${{ matrix.prepared_statements }}
37
+ DRIVER: ${{ matrix.driver }}
38
+ JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M"
39
+
40
+ steps:
41
+ - uses: actions/checkout@v3
42
+ - name: Set up Ruby
43
+ uses: ruby/setup-ruby@v1
44
+ with:
45
+ ruby-version: ${{ matrix.ruby-version }}
46
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
47
+ - name: Setup database
48
+ run: |
49
+ sudo service mysql start
50
+ mysql --version || true # to see if we're using MySQL or MariaDB
51
+ mysql -u root -proot -e "CREATE USER rails@localhost;"
52
+ mysql -u root -proot -e "grant all privileges on activerecord_unittest.* to rails@localhost;"
53
+ mysql -u root -proot -e "grant all privileges on activerecord_unittest2.* to rails@localhost;"
54
+ mysql -u root -proot -e "grant all privileges on inexistent_activerecord_unittest.* to rails@localhost;"
55
+ mysql -u root -proot -e "CREATE DATABASE activerecord_unittest DEFAULT CHARACTER SET utf8mb4;"
56
+ mysql -u root -proot -e "CREATE DATABASE activerecord_unittest2 DEFAULT CHARACTER SET utf8mb4;"
57
+ - name: Build
58
+ run: |
59
+ echo "JAVA_OPTS=$JAVA_OPTS"
60
+ rake jar # compiles ext generates: lib/arjdbc/jdbc/adapter_java.jar
61
+ - name: Run tests
62
+ run: |
63
+ bundle exec rake ${{ matrix.test_targets }}
64
+
65
+ test-rails-pgsql:
66
+
67
+ name: Rails Tests (Postgres)
68
+ runs-on: ubuntu-latest
69
+ strategy:
70
+ fail-fast: false
71
+ matrix:
72
+ ruby-version: [ 'jruby-9.2.20.1' ]
73
+ db: [ 'postgresql' ]
74
+ test_targets: [ "rails:test_postgresql" ]
75
+ ar_version: ["6-1-stable"]
76
+ prepared_statements: [ 'false', 'true' ]
77
+
78
+ services:
79
+ postgres:
80
+ image: postgres:10
81
+ env:
82
+ POSTGRES_PASSWORD: postgres
83
+ POSTGRES_HOST_AUTH_METHOD: trust
84
+ ports:
85
+ - 5432:5432
86
+ options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
87
+
88
+ env:
89
+ DB: ${{ matrix.db }}
90
+ AR_VERSION: ${{ matrix.ar_version }}
91
+ JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M"
92
+ PREPARED_STATEMENTS: ${{ matrix.prepared_statements }}
93
+ PGHOST: localhost
94
+ PGPORT: 5432
95
+ PGUSER: postgres
96
+
97
+ steps:
98
+ - uses: actions/checkout@v3
99
+ - name: Set up Ruby
100
+ uses: ruby/setup-ruby@v1
101
+ with:
102
+ ruby-version: ${{ matrix.ruby-version }}
103
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
104
+ - name: Setup database
105
+ run: |
106
+ psql -c "create database activerecord_unittest;" -U postgres
107
+ psql -c "create database activerecord_unittest2;" -U postgres
108
+ - name: Build
109
+ run: |
110
+ rake jar # compiles ext generates: lib/arjdbc/jdbc/adapter_java.jar
111
+ - name: Run tests
112
+ run: |
113
+ bundle exec rake ${{ matrix.test_targets }}
114
+
115
+ test-rails-sqlite:
116
+
117
+ name: Rails Tests (SQLite)
118
+ runs-on: ubuntu-latest
119
+ strategy:
120
+ fail-fast: false
121
+ matrix:
122
+ ruby-version: ['jruby-9.2.20.1']
123
+ db: ['sqlite3']
124
+ test_targets: ["rails:test_sqlite3"]
125
+ ar_version: ["6-1-stable"]
126
+
127
+ env:
128
+ DB: ${{ matrix.db }}
129
+ AR_VERSION: ${{ matrix.ar_version }}
130
+ JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M"
131
+
132
+ steps:
133
+ - uses: actions/checkout@v3
134
+ - name: Set up Ruby
135
+ uses: ruby/setup-ruby@v1
136
+ with:
137
+ ruby-version: ${{ matrix.ruby-version }}
138
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
139
+ - name: Build
140
+ run: |
141
+ echo "JAVA_OPTS=$JAVA_OPTS"
142
+ rake jar # compiles ext generates: lib/arjdbc/jdbc/adapter_java.jar
143
+ - name: Run tests
144
+ run: |
145
+ bundle exec rake ${{ matrix.test_targets }}
146
+
147
+ test-arjdbc-mysql:
148
+
149
+ name: ARJDBC Tests (MySQL)
150
+ runs-on: ubuntu-latest
151
+ strategy:
152
+ fail-fast: false
153
+ matrix:
154
+ ruby-version: ['jruby-9.2.20.1']
155
+ db: ['mysql2']
156
+ test_targets: ["db:mysql test_mysql2"]
157
+ prepared_statements: ['false', 'true']
158
+ driver: ['MySQL']
159
+
160
+ services:
161
+ mysql:
162
+ image: mysql:5.7
163
+ ports:
164
+ - 3306
165
+
166
+ env:
167
+ DB: ${{ matrix.db }}
168
+ DRIVER: ${{ matrix.driver }}
169
+ JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M"
170
+ MY_USER: root
171
+ MY_PASSWORD: root
172
+ PREPARED_STATEMENTS: ${{ matrix.prepared_statements }}
173
+
174
+ steps:
175
+ - uses: actions/checkout@v3
176
+ - name: Set up Ruby
177
+ uses: ruby/setup-ruby@v1
178
+ with:
179
+ ruby-version: ${{ matrix.ruby-version }}
180
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
181
+ - name: Setup database
182
+ run: |
183
+ sudo service mysql start
184
+ mysql --version || true # to see if we're using MySQL or MariaDB
185
+ - name: Build
186
+ run: |
187
+ rake jar
188
+ - name: Run tests
189
+ run: |
190
+ bundle exec rake ${{ matrix.test_targets }}
191
+
192
+ test-arjdbc-pgsql:
193
+
194
+ name: ARJDBC Tests (Postgres)
195
+ runs-on: ubuntu-latest
196
+ strategy:
197
+ fail-fast: false
198
+ matrix:
199
+ ruby-version: ['jruby-9.2.20.1']
200
+ db: ['postgresql']
201
+ test_targets: ["db:postgresql test_postgresql"]
202
+ prepared_statements: ['false', 'true']
203
+ insert_returning: ['false', 'true']
204
+
205
+ services:
206
+ postgres:
207
+ image: postgres:10
208
+ env:
209
+ POSTGRES_PASSWORD: postgres
210
+ POSTGRES_HOST_AUTH_METHOD: trust
211
+ ports:
212
+ - 5432:5432
213
+ options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
214
+
215
+ env:
216
+ DB: ${{ matrix.db }}
217
+ DRIVER: ${{ matrix.driver }}
218
+ JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M"
219
+ PREPARED_STATEMENTS: ${{ matrix.prepared_statements }}
220
+ INSERT_RETURNING: ${{ matrix.insert_returning }}
221
+ PGHOST: localhost
222
+ PGPORT: 5432
223
+ PGUSER: postgres
224
+
225
+ steps:
226
+ - uses: actions/checkout@v3
227
+ - name: Set up Ruby
228
+ uses: ruby/setup-ruby@v1
229
+ with:
230
+ ruby-version: ${{ matrix.ruby-version }}
231
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
232
+ - name: Build
233
+ run: |
234
+ rake jar
235
+ - name: Run tests
236
+ run: |
237
+ bundle exec rake ${{ matrix.test_targets }}
238
+
239
+ test-arjdbc-sqlite:
240
+
241
+ name: ARJDBC Tests (SQLite)
242
+ runs-on: ubuntu-latest
243
+ strategy:
244
+ fail-fast: false
245
+ matrix:
246
+ ruby-version: ['jruby-9.2.20.1']
247
+ db: ['sqlite3']
248
+ test_targets: ['test_sqlite3']
249
+
250
+ env:
251
+ DB: ${{ matrix.db }}
252
+ JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M"
253
+
254
+ steps:
255
+ - uses: actions/checkout@v3
256
+ - name: Set up Ruby
257
+ uses: ruby/setup-ruby@v1
258
+ with:
259
+ ruby-version: ${{ matrix.ruby-version }}
260
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
261
+ - name: Build
262
+ run: |
263
+ rake jar
264
+ - name: Run tests
265
+ run: |
266
+ bundle exec rake ${{ matrix.test_targets }}
data/.travis.yml CHANGED
@@ -9,13 +9,14 @@ before_install:
9
9
  - rvm @default,@global do gem uninstall bundler -a -x -I || true
10
10
  - gem install bundler -v "~>1.17.3"
11
11
  install:
12
- - bundle install --retry 3 --without development
12
+ - bundle config set --local without 'development'
13
+ - bundle install
13
14
  # to fix this issue: https://travis-ci.community/t/mariadb-10-1-fails-to-install-on-xenial/3151/3
14
15
  - mysql -u root -e 'CREATE USER IF NOT EXISTS travis@localhost; GRANT ALL ON *.* TO travis@localhost;' || true
15
16
 
16
17
  language: ruby
17
18
  rvm:
18
- - jruby-9.2.7.0
19
+ - jruby-9.2.19.0
19
20
  jdk:
20
21
  - openjdk8
21
22
 
@@ -37,8 +38,8 @@ before_script:
37
38
  mysql -e "grant all privileges on activerecord_unittest.* to rails@localhost;" && \
38
39
  mysql -e "grant all privileges on activerecord_unittest2.* to rails@localhost;" && \
39
40
  mysql -e "grant all privileges on inexistent_activerecord_unittest.* to rails@localhost;" && \
40
- mysql -e "CREATE DATABASE activerecord_unittest DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;" && \
41
- mysql -e "CREATE DATABASE activerecord_unittest2 DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;" \
41
+ mysql -e "CREATE DATABASE activerecord_unittest DEFAULT CHARACTER SET utf8mb4;" && \
42
+ mysql -e "CREATE DATABASE activerecord_unittest2 DEFAULT CHARACTER SET utf8mb4;" \
42
43
  || true
43
44
  - |
44
45
  [ "$DB" == "postgresql" ] && [ "$TEST_PREFIX" == "rails:" ] && \
@@ -48,7 +49,7 @@ before_script:
48
49
 
49
50
  env:
50
51
  global:
51
- - AR_VERSION="6-0-stable"
52
+ - AR_VERSION="6-1-stable"
52
53
  matrix:
53
54
  allow_failures:
54
55
  - rvm: jruby-head
@@ -111,18 +112,18 @@ matrix:
111
112
  env: DB=mariadb PREPARED_STATEMENTS=true
112
113
 
113
114
  # Rails test-suite :
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
115
+ - env: DB=mysql2 TEST_PREFIX="rails:" AR_VERSION="6-1-stable" # PS off by default
116
+ - env: DB=mysql2 TEST_PREFIX="rails:" AR_VERSION="6-1-stable" PREPARED_STATEMENTS=true
117
+ - env: DB=mysql2 TEST_PREFIX="rails:" AR_VERSION="6-1-stable" DRIVER=MariaDB
117
118
 
118
119
  - addons:
119
120
  postgresql: "10"
120
- env: DB=postgresql TEST_PREFIX="rails:" AR_VERSION="6-0-stable" # PS on by default
121
+ env: DB=postgresql TEST_PREFIX="rails:" AR_VERSION="6-1-stable" # PS on by default
121
122
  - addons:
122
123
  postgresql: "10"
123
- env: DB=postgresql TEST_PREFIX="rails:" AR_VERSION="6-0-stable" PREPARED_STATEMENTS=false
124
+ env: DB=postgresql TEST_PREFIX="rails:" AR_VERSION="6-1-stable" PREPARED_STATEMENTS=false
124
125
  - addons:
125
126
  postgresql: "9.4"
126
- env: DB=postgresql TEST_PREFIX="rails:" AR_VERSION="6-0-stable" # PS on by default
127
+ env: DB=postgresql TEST_PREFIX="rails:" AR_VERSION="6-1-stable" # PS on by default
127
128
 
128
- - env: DB=sqlite3 TEST_PREFIX="rails:" AR_VERSION="6-0-stable"
129
+ - env: DB=sqlite3 TEST_PREFIX="rails:" AR_VERSION="6-1-stable"
data/Gemfile CHANGED
@@ -59,7 +59,7 @@ end
59
59
 
60
60
  group :rails do
61
61
  group :test do
62
- gem 'minitest', '~> 5.11.3', require: nil
62
+ gem 'minitest', '~> 5.12.2', require: nil
63
63
  gem 'minitest-excludes', '~> 2.0.1', require: nil
64
64
  gem 'minitest-rg', require: nil
65
65
 
data/README.md CHANGED
@@ -23,7 +23,8 @@ Versions are targeted at certain versions of Rails and live on their own branche
23
23
  | 50.x | 5.0.x | 50-stable | 9.1.x | 7 |
24
24
  | 51.x | 5.1.x | 51-stable | 9.1.x | 7 |
25
25
  | 52.x | 5.2.x | 52-stable | 9.1.x | 7 |
26
- | 60.x | 6.0.x | master | 9.2.7 | 8 |
26
+ | 60.x | 6.0.x | 60-stable | 9.2.7 | 8 |
27
+ | 61.x | 6.1.x | master | 9.2.7 | 8 |
27
28
 
28
29
  Note that JRuby 9.1.x is end-of-life. We recommend Java 8 at a minimum for all
29
30
  versions.
@@ -116,8 +117,8 @@ Proceed as with Rails; specify `ActiveRecord` in your Bundle along with the
116
117
  chosen JDBC adapter(s), this time sample *Gemfile* for MySQL:
117
118
 
118
119
  ```ruby
119
- gem 'activerecord', '~> 5.0.6'
120
- gem 'activerecord-jdbcmysql-adapter', :platform => :jruby
120
+ gem 'activerecord', '~> 6.0.3'
121
+ gem 'activerecord-jdbcmysql-adapter', '~> 60.2', :platform => :jruby
121
122
  ```
122
123
 
123
124
  When you `require 'bundler/setup'` everything will be set up for you as expected.
@@ -126,13 +127,13 @@ When you `require 'bundler/setup'` everything will be set up for you as expected
126
127
 
127
128
  Install the needed gems with JRuby, for example:
128
129
 
129
- gem install activerecord -v "~> 5.0.6"
130
- gem install activerecord-jdbc-adapter --ignore-dependencies
130
+ gem install activerecord -v "~> 6.0.3"
131
+ gem install activerecord-jdbc-adapter -v "~> 60.2" --ignore-dependencies
131
132
 
132
133
  If you wish to use the adapter for a specific database, you can install it
133
134
  directly and the (jdbc-) driver gem (dependency) will be installed as well:
134
135
 
135
- jruby -S gem install activerecord-jdbcmysql-adapter
136
+ jruby -S gem install activerecord-jdbcmysql-adapter -v "~> 60.2"
136
137
 
137
138
  Your program should include:
138
139
 
@@ -172,7 +173,7 @@ ask on the #JRuby IRC channel on http://freenode.net/ (try [web-chat][6]).
172
173
  This project was originally written by [Nick Sieger](http://github.com/nicksieger)
173
174
  and [Ola Bini](http://github.com/olabini) with lots of help from the JRuby community.
174
175
  Polished 3.x compatibility and 4.x support (for AR-JDBC >= 1.3.0) was managed by
175
- [Karol Bucek](http://github.com/kares) among others. Support for Rails 6 was
176
+ [Karol Bucek](http://github.com/kares) among others. Support for Rails 6.0 and 6.1 was
176
177
  contributed by [shellyBits GmbH](https://shellybits.ch/)
177
178
 
178
179
  ## License
@@ -41,7 +41,7 @@ Gem::Specification.new do |gem|
41
41
  gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
42
42
  gem.test_files = gem.files.grep(%r{^test/})
43
43
 
44
- gem.add_dependency 'activerecord', '~> 6.0.0'
44
+ gem.add_dependency 'activerecord', '~> 6.1.0'
45
45
 
46
46
  #gem.add_development_dependency 'test-unit', '2.5.4'
47
47
  #gem.add_development_dependency 'test-unit-context', '>= 0.3.0'
@@ -2,5 +2,5 @@ require 'arel/visitors/compat'
2
2
 
3
3
  class Arel::Visitors::PostgreSQL
4
4
  # AREL converts bind argument markers "?" to "$n" for PG, but JDBC wants "?".
5
- remove_method :visit_Arel_Nodes_BindParam if ArJdbc::AR42
5
+ remove_method :bind_block
6
6
  end
@@ -56,6 +56,7 @@ module ArJdbc
56
56
  case exception
57
57
  when SystemExit, SignalException, NoMemoryError then exception
58
58
  when ActiveModel::RangeError, TypeError, RuntimeError then exception
59
+ when ActiveRecord::ConnectionNotEstablished then exception
59
60
  else super
60
61
  end
61
62
  end
@@ -15,6 +15,7 @@ module ArJdbc
15
15
  end
16
16
 
17
17
  materialize_transactions
18
+ mark_transaction_written_if_write(sql)
18
19
 
19
20
  binds = convert_legacy_binds_to_attributes(binds) if binds.first.is_a?(Array)
20
21
 
@@ -35,6 +36,7 @@ module ArJdbc
35
36
  end
36
37
 
37
38
  materialize_transactions
39
+ mark_transaction_written_if_write(sql)
38
40
 
39
41
  binds = convert_legacy_binds_to_attributes(binds) if binds.first.is_a?(Array)
40
42
 
@@ -55,6 +57,7 @@ module ArJdbc
55
57
  end
56
58
 
57
59
  materialize_transactions
60
+ mark_transaction_written_if_write(sql)
58
61
 
59
62
  binds = convert_legacy_binds_to_attributes(binds) if binds.first.is_a?(Array)
60
63
 
@@ -72,6 +75,7 @@ module ArJdbc
72
75
  end
73
76
 
74
77
  materialize_transactions
78
+ mark_transaction_written_if_write(sql)
75
79
 
76
80
  log(sql, name) { @connection.execute(sql) }
77
81
  end
@@ -24,26 +24,26 @@ module ArJdbc
24
24
  # Starts a database transaction.
25
25
  # @override
26
26
  def begin_db_transaction
27
- log('BEGIN TRANSACTION', nil) { @connection.begin }
27
+ log('BEGIN', 'TRANSACTION') { @connection.begin }
28
28
  end
29
29
 
30
30
  # Starts a database transaction.
31
31
  # @param isolation the transaction isolation to use
32
32
  def begin_isolated_db_transaction(isolation)
33
- log("BEGIN ISOLATED TRANSACTION - #{isolation}", nil) { @connection.begin(isolation) }
33
+ log("BEGIN ISOLATED - #{isolation}", 'TRANSACTION') { @connection.begin(isolation) }
34
34
  end
35
35
 
36
36
  # Commits the current database transaction.
37
37
  # @override
38
38
  def commit_db_transaction
39
- log('COMMIT TRANSACTION', nil) { @connection.commit }
39
+ log('COMMIT', 'TRANSACTION') { @connection.commit }
40
40
  end
41
41
 
42
42
  # Rolls back the current database transaction.
43
43
  # Called from 'rollback_db_transaction' in the AbstractAdapter
44
44
  # @override
45
45
  def exec_rollback_db_transaction
46
- log('ROLLBACK TRANSACTION', nil) { @connection.rollback }
46
+ log('ROLLBACK', 'TRANSACTION') { @connection.rollback }
47
47
  end
48
48
 
49
49
  ########################## Savepoint Interface ############################
@@ -55,7 +55,7 @@ module ArJdbc
55
55
  # @since 1.3.0
56
56
  # @extension added optional name parameter
57
57
  def create_savepoint(name = current_savepoint_name)
58
- log("SAVEPOINT #{name}", 'Savepoint') { @connection.create_savepoint(name) }
58
+ log("SAVEPOINT #{name}", 'TRANSACTION') { @connection.create_savepoint(name) }
59
59
  end
60
60
 
61
61
  # Transaction rollback to a given (previously created) save-point.
@@ -64,7 +64,7 @@ module ArJdbc
64
64
  # @param name the save-point name
65
65
  # @extension added optional name parameter
66
66
  def exec_rollback_to_savepoint(name = current_savepoint_name)
67
- log("ROLLBACK TO SAVEPOINT #{name}", 'Savepoint') { @connection.rollback_savepoint(name) }
67
+ log("ROLLBACK TO SAVEPOINT #{name}", 'TRANSACTION') { @connection.rollback_savepoint(name) }
68
68
  end
69
69
 
70
70
  # Release a previously created save-point.
@@ -73,9 +73,22 @@ module ArJdbc
73
73
  # @param name the save-point name
74
74
  # @extension added optional name parameter
75
75
  def release_savepoint(name = current_savepoint_name)
76
- log("RELEASE SAVEPOINT #{name}", 'Savepoint') { @connection.release_savepoint(name) }
76
+ log("RELEASE SAVEPOINT #{name}", 'TRANSACTION') { @connection.release_savepoint(name) }
77
77
  end
78
78
 
79
79
  end
80
80
  end
81
81
  end
82
+
83
+ # patch to avoid the usage of WeakMap
84
+ require 'active_record/connection_adapters/abstract/transaction'
85
+ module ActiveRecord
86
+ module ConnectionAdapters
87
+ class Transaction
88
+ def add_record(record, ensure_finalize = true)
89
+ @records ||= []
90
+ @records << record
91
+ end
92
+ end
93
+ end
94
+ end
Binary file
@@ -2,7 +2,9 @@
2
2
 
3
3
  module ActiveRecord
4
4
 
5
- if defined? ConnectionAdapters::ConnectionSpecification::Resolver # 4.0
5
+ if defined? ConnectionAdapters::ConnectionHandler # 6.1
6
+ ConnectionAdapters::ConnectionHandler
7
+ elsif defined? ConnectionAdapters::ConnectionSpecification::Resolver # 4.0, # 5.x, # 6.0
6
8
  ConnectionAdapters::ConnectionSpecification::Resolver
7
9
  elsif defined? Base::ConnectionSpecification::Resolver # 3.2
8
10
  Base::ConnectionSpecification::Resolver
@@ -33,10 +33,10 @@ module ActiveRecord
33
33
 
34
34
  include ArJdbc::MySQL
35
35
 
36
- def initialize(connection, logger, connection_parameters, config)
37
- super
36
+ def initialize(connection, logger, connection_options, config)
37
+ superclass_config = config.reverse_merge(prepared_statements: false)
38
+ super(connection, logger, connection_options, superclass_config)
38
39
 
39
- @prepared_statements = false unless config.key?(:prepared_statements)
40
40
  # configure_connection taken care of at ArJdbc::Abstract::Core
41
41
  end
42
42
 
@@ -88,7 +88,7 @@ module ActiveRecord
88
88
 
89
89
  # from MySQL::DatabaseStatements
90
90
  READ_QUERY = ActiveRecord::ConnectionAdapters::AbstractAdapter.build_read_query_regexp(
91
- :begin, :commit, :explain, :select, :set, :show, :release, :savepoint, :rollback, :describe, :desc
91
+ :desc, :describe, :set, :show, :use
92
92
  ) # :nodoc:
93
93
  private_constant :READ_QUERY
94
94
 
@@ -96,6 +96,15 @@ module ActiveRecord
96
96
  !READ_QUERY.match?(sql)
97
97
  end
98
98
 
99
+ def explain(arel, binds = [])
100
+ sql = "EXPLAIN #{to_sql(arel, binds)}"
101
+ start = Concurrent.monotonic_time
102
+ result = exec_query(sql, "EXPLAIN", binds)
103
+ elapsed = Concurrent.monotonic_time - start
104
+
105
+ MySQL::ExplainPrettyPrinter.new.pp(result, elapsed)
106
+ end
107
+
99
108
  # Reloading the type map in abstract/statement_cache.rb blows up postgres
100
109
  def clear_cache!
101
110
  reload_type_map
@@ -179,7 +188,7 @@ module ActiveRecord
179
188
 
180
189
  # defined in MySQL::DatabaseStatements which is not included
181
190
  def default_insert_value(column)
182
- Arel.sql("DEFAULT") unless column.auto_increment?
191
+ super unless column.auto_increment?
183
192
  end
184
193
 
185
194
  # FIXME: optimize insert_fixtures_set by using JDBC Statement.addBatch()/executeBatch()
@@ -68,6 +68,7 @@ ArJdbc::ConnectionMethods.module_eval do
68
68
  # with reconnect fail-over sets connection read-only (by default)
69
69
  # properties['failOverReadOnly'] ||= 'false'
70
70
  end
71
+ properties['noDatetimeStringSync'] = true unless properties.key?('noDatetimeStringSync')
71
72
  end
72
73
  if config[:sslkey] || sslcert = config[:sslcert] # || config[:use_ssl]
73
74
  properties['useSSL'] ||= true # supported by MariaDB as well
@@ -90,11 +91,12 @@ ArJdbc::ConnectionMethods.module_eval do
90
91
  properties['localSocket'] ||= socket if mariadb_driver
91
92
  end
92
93
 
94
+ # properties['useJDBCCompliantTimezoneShift'] ||= true
93
95
  # for the Connector/J 5.1 line this is true by default - but it requires some really nasty
94
96
  # quirks to get casted Time values extracted properly according for AR's default_timezone
95
97
  # - thus we're turning it off (should be off in newer driver versions >= 6 anyway)
96
98
  # + also MariaDB driver is compilant and we would need to branch out based on driver
97
- properties['useLegacyDatetimeCode'] = false
99
+ properties['useLegacyDatetimeCode'] = false # disables the effect of 'useTimezone'
98
100
 
99
101
  jdbc_connection(config)
100
102
  end
@@ -102,6 +104,8 @@ ArJdbc::ConnectionMethods.module_eval do
102
104
  alias_method :mysql2_connection, :mysql_connection
103
105
 
104
106
  def mariadb_connection(config)
107
+ config = config.deep_dup
108
+
105
109
  config[:adapter_spec] ||= ::ArJdbc::MySQL
106
110
  config[:adapter_class] = ActiveRecord::ConnectionAdapters::Mysql2Adapter unless config.key?(:adapter_class)
107
111