activerecord-jdbc-adapter 52.2-java → 52.3-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +22 -18
- data/Rakefile +1 -1
- data/lib/arjdbc/db2/adapter.rb +11 -0
- data/lib/arjdbc/jdbc/adapter.rb +4 -0
- data/lib/arjdbc/mysql/connection_methods.rb +12 -7
- data/lib/arjdbc/postgresql/connection_methods.rb +2 -1
- data/lib/arjdbc/version.rb +1 -1
- data/src/java/arjdbc/util/DateTimeUtils.java +8 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e777dea191806a6cde6a0503077077c57698b5d524e1acc31c98a6fe2dd8cfd
|
4
|
+
data.tar.gz: 2f681bfdab105c7e598533d465476e3b265b9ad845d5d3eab494b763af71711c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7931428c670ff5ed6ff3db57dbc00eca7462602caef72b6ae92003b344e6df201ed8b82e4cc5e16e16304506ae1501beaf2c7bf0e4bf312ecab08218060ccd8d
|
7
|
+
data.tar.gz: f55aee0913cb8ffb5103a9123bff3188cbdef23744d05dde034948dadd2ffb82190c31653563c2ed00ed061849f65906f59a7f6a7da99ee3c69eaab0795e74f3
|
data/.travis.yml
CHANGED
@@ -1,18 +1,27 @@
|
|
1
|
-
language: ruby
|
2
1
|
sudo: false
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
bundler_args: --without development
|
11
|
-
script: bundle exec rake ${TEST_PREFIX}test_$DB
|
2
|
+
dist: xenial
|
3
|
+
|
4
|
+
services:
|
5
|
+
- mysql
|
6
|
+
addons:
|
7
|
+
postgresql: 9.4
|
8
|
+
|
12
9
|
before_install:
|
13
10
|
- unset _JAVA_OPTIONS
|
14
11
|
- rvm @default,@global do gem uninstall bundler -a -x -I || true
|
15
12
|
- gem install bundler -v "~>1.17.3"
|
13
|
+
install:
|
14
|
+
- bundle install --retry 3 --without development
|
15
|
+
# to fix this issue: https://travis-ci.community/t/mariadb-10-1-fails-to-install-on-xenial/3151/3
|
16
|
+
- mysql -u root -e 'CREATE USER IF NOT EXISTS travis@localhost; GRANT ALL ON *.* TO travis@localhost;' || true
|
17
|
+
|
18
|
+
language: ruby
|
19
|
+
rvm:
|
20
|
+
- jruby-9.1.16.0
|
21
|
+
jdk:
|
22
|
+
- openjdk8
|
23
|
+
|
24
|
+
script: bundle exec rake ${TEST_PREFIX}test_$DB
|
16
25
|
before_script:
|
17
26
|
- echo "JAVA_OPTS=$JAVA_OPTS"
|
18
27
|
- export JRUBY_OPTS="-J-Xms64M -J-Xmx1024M"
|
@@ -38,12 +47,7 @@ before_script:
|
|
38
47
|
psql -c "create database activerecord_unittest;" -U postgres && \
|
39
48
|
psql -c "create database activerecord_unittest2;" -U postgres \
|
40
49
|
|| true
|
41
|
-
|
42
|
-
- jruby-9.1.16.0
|
43
|
-
jdk:
|
44
|
-
- openjdk8
|
45
|
-
addons:
|
46
|
-
postgresql: "9.4"
|
50
|
+
|
47
51
|
env:
|
48
52
|
- DB=mysql2 PREPARED_STATEMENTS=false
|
49
53
|
- DB=mysql2 PREPARED_STATEMENTS=true
|
@@ -86,10 +90,10 @@ matrix:
|
|
86
90
|
env: DB=sqlite3
|
87
91
|
# testing against MariaDB
|
88
92
|
- addons:
|
89
|
-
mariadb:
|
93
|
+
mariadb: 10.2
|
90
94
|
env: DB=mariadb PREPARED_STATEMENTS=false
|
91
95
|
- addons:
|
92
|
-
mariadb:
|
96
|
+
mariadb: 10.3
|
93
97
|
env: DB=mariadb PREPARED_STATEMENTS=true
|
94
98
|
# Rails test-suite :
|
95
99
|
- env: DB=mysql2 TEST_PREFIX="rails:" AR_VERSION="v5.2.3" # PS off by default
|
data/Rakefile
CHANGED
@@ -257,7 +257,7 @@ if defined? JRUBY_VERSION
|
|
257
257
|
begin
|
258
258
|
require 'arjdbc/version'
|
259
259
|
rescue LoadError
|
260
|
-
path = File.expand_path('
|
260
|
+
path = File.expand_path('lib', File.dirname(__FILE__))
|
261
261
|
unless $LOAD_PATH.include?(path)
|
262
262
|
$LOAD_PATH << path; retry
|
263
263
|
end
|
data/lib/arjdbc/db2/adapter.rb
CHANGED
@@ -328,6 +328,17 @@ module ArJdbc
|
|
328
328
|
select_one(sql).nil?
|
329
329
|
end
|
330
330
|
|
331
|
+
# @override
|
332
|
+
def primary_keys(table)
|
333
|
+
# If no schema in table name is given but present in URL parameter. Use the URL parameter one
|
334
|
+
# This avoids issues if the table is present in multiple schemas
|
335
|
+
if table.split(".").size == 1 && schema
|
336
|
+
table = "#{schema}.#{table}"
|
337
|
+
end
|
338
|
+
|
339
|
+
super
|
340
|
+
end
|
341
|
+
|
331
342
|
def next_sequence_value(sequence_name)
|
332
343
|
select_value("SELECT NEXT VALUE FOR #{sequence_name} FROM sysibm.sysdummy1")
|
333
344
|
end
|
data/lib/arjdbc/jdbc/adapter.rb
CHANGED
@@ -358,6 +358,10 @@ module ActiveRecord
|
|
358
358
|
# @return [Integer, NilClass]
|
359
359
|
def last_inserted_id(result)
|
360
360
|
if result.is_a?(Hash) || result.is_a?(ActiveRecord::Result)
|
361
|
+
# If table does not have primary key defined
|
362
|
+
return nil if result.first.blank?
|
363
|
+
|
364
|
+
|
361
365
|
result.first.first[1] # .first = { "id"=>1 } .first = [ "id", 1 ]
|
362
366
|
else
|
363
367
|
result
|
@@ -10,11 +10,9 @@ ArJdbc::ConnectionMethods.module_eval do
|
|
10
10
|
|
11
11
|
return jndi_connection(config) if jndi_config?(config)
|
12
12
|
|
13
|
-
driver = config[:driver]
|
14
|
-
|
15
|
-
|
16
|
-
mysql_driver = driver.start_with?('com.mysql.')
|
17
|
-
mariadb_driver = ! mysql_driver && driver.start_with?('org.mariadb.')
|
13
|
+
driver = config[:driver]
|
14
|
+
mysql_driver = driver.nil? || driver.to_s.start_with?('com.mysql.')
|
15
|
+
mariadb_driver = ! mysql_driver && driver.to_s.start_with?('org.mariadb.')
|
18
16
|
|
19
17
|
begin
|
20
18
|
require 'jdbc/mysql'
|
@@ -22,6 +20,11 @@ ArJdbc::ConnectionMethods.module_eval do
|
|
22
20
|
rescue LoadError # assuming driver.jar is on the class-path
|
23
21
|
end if mysql_driver
|
24
22
|
|
23
|
+
if driver.nil?
|
24
|
+
config[:driver] ||=
|
25
|
+
defined?(::Jdbc::MySQL.driver_name) ? ::Jdbc::MySQL.driver_name : 'com.mysql.jdbc.Driver'
|
26
|
+
end
|
27
|
+
|
25
28
|
config[:username] = 'root' unless config.key?(:username)
|
26
29
|
# jdbc:mysql://[host][,failoverhost...][:port]/[database]
|
27
30
|
# - if the host name is not specified, it defaults to 127.0.0.1
|
@@ -36,7 +39,8 @@ ArJdbc::ConnectionMethods.module_eval do
|
|
36
39
|
|
37
40
|
properties = ( config[:properties] ||= {} )
|
38
41
|
if mysql_driver
|
39
|
-
properties['zeroDateTimeBehavior'] ||=
|
42
|
+
properties['zeroDateTimeBehavior'] ||=
|
43
|
+
config[:driver].to_s.start_with?('com.mysql.cj.') ? 'CONVERT_TO_NULL' : 'convertToNull'
|
40
44
|
properties['jdbcCompliantTruncation'] ||= false
|
41
45
|
# NOTE: this is "better" than passing what users are used to set on MRI
|
42
46
|
# e.g. 'utf8mb4' will fail cause the driver will check for a Java charset
|
@@ -108,7 +112,8 @@ ArJdbc::ConnectionMethods.module_eval do
|
|
108
112
|
rescue LoadError # assuming driver.jar is on the class-path
|
109
113
|
end
|
110
114
|
|
111
|
-
config[:driver] ||=
|
115
|
+
config[:driver] ||=
|
116
|
+
defined?(::Jdbc::MariaDB.driver_name) ? ::Jdbc::MariaDB.driver_name : 'org.mariadb.jdbc.Driver'
|
112
117
|
|
113
118
|
mysql_connection(config)
|
114
119
|
end
|
@@ -16,7 +16,8 @@ ArJdbc::ConnectionMethods.module_eval do
|
|
16
16
|
::Jdbc::Postgres.load_driver(:require) if defined?(::Jdbc::Postgres.load_driver)
|
17
17
|
rescue LoadError # assuming driver.jar is on the class-path
|
18
18
|
end
|
19
|
-
driver = config[:driver] ||=
|
19
|
+
driver = (config[:driver] ||=
|
20
|
+
defined?(::Jdbc::Postgres.driver_name) ? ::Jdbc::Postgres.driver_name : 'org.postgresql.Driver')
|
20
21
|
|
21
22
|
host = config[:host] ||= ( config[:hostaddr] || ENV['PGHOST'] || 'localhost' )
|
22
23
|
port = config[:port] ||= ( ENV['PGPORT'] || 5432 )
|
data/lib/arjdbc/version.rb
CHANGED
@@ -218,9 +218,11 @@ public abstract class DateTimeUtils {
|
|
218
218
|
final int hours = time.getHours();
|
219
219
|
final int minutes = time.getMinutes();
|
220
220
|
final int seconds = time.getSeconds();
|
221
|
-
|
221
|
+
int nanos = time.getNanos(); // max 999-999-999
|
222
|
+
final int millis = nanos / 1000000;
|
223
|
+
nanos = nanos % 1000000;
|
222
224
|
|
223
|
-
DateTime dateTime = new DateTime(2000, 1, 1, hours, minutes, seconds, defaultZone);
|
225
|
+
DateTime dateTime = new DateTime(2000, 1, 1, hours, minutes, seconds, millis, defaultZone);
|
224
226
|
return RubyTime.newTime(context.runtime, dateTime, nanos);
|
225
227
|
}
|
226
228
|
|
@@ -233,9 +235,11 @@ public abstract class DateTimeUtils {
|
|
233
235
|
final int hours = timestamp.getHours();
|
234
236
|
final int minutes = timestamp.getMinutes();
|
235
237
|
final int seconds = timestamp.getSeconds();
|
236
|
-
|
238
|
+
int nanos = timestamp.getNanos(); // max 999-999-999
|
239
|
+
final int millis = nanos / 1000000;
|
240
|
+
nanos = nanos % 1000000;
|
237
241
|
|
238
|
-
DateTime dateTime = new DateTime(year, month, day, hours, minutes, seconds,
|
242
|
+
DateTime dateTime = new DateTime(year, month, day, hours, minutes, seconds, millis, defaultZone);
|
239
243
|
return RubyTime.newTime(context.runtime, dateTime, nanos);
|
240
244
|
}
|
241
245
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-jdbc-adapter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '52.
|
4
|
+
version: '52.3'
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Nick Sieger, Ola Bini, Karol Bucek and JRuby contributors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-07-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|