activerecord-jdbc-adapter 51.3-java → 51.4-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: 7117b15f231051ebccb138e4f19e65780e179a751dc44fdb58dd54677af296b6
4
- data.tar.gz: bad84fbfae38b6d2b30d6bbc09893001c0e2a60ab7137ace692462e257197807
3
+ metadata.gz: 63cf6264259b636000fa1b17e13d555ca97d91aa9e237026bb81bac717b3130f
4
+ data.tar.gz: ca5867009951cda63cccf434b87ec38fc0b541cd8a206899ed9ba23841ceb0c4
5
5
  SHA512:
6
- metadata.gz: 22e383cc2c136411ce1b70fcb28bb17f83aee13ecffa69bdc5768c53787fc1eb9f8ba566dcc31433a5bfca46788d905222cc4f721c0dc1b83af1fe721a494c91
7
- data.tar.gz: '084f6078c6887cf33d8c99f9ecf1b2fb907d3e5a1c27ea04058c30773970a295701846d6869e672aff9e8e7141ce29883be763f8b829dbefb36e8ddb562cbd01'
6
+ metadata.gz: a762d4f3877d7c834da321fa67784cee8ca8999c22ac3ec9d9e3f5f65df0d52ed2261dde7a91287c4b9cd0d5641f6786e26e0ab470d1b4c4c6527624163bbaf5
7
+ data.tar.gz: 5fb6ee5eafa8a10a7389f7c4a471061553e5ca97e9347b2f78f69d94ec2fca28277f109eeeebe636de053324a346dcab25eab379351e46afd475855296bd3ae4
data/.travis.yml CHANGED
@@ -1,18 +1,27 @@
1
- language: ruby
2
1
  sudo: false
3
- branches:
4
- only:
5
- - master
6
- - /.*-stable$/
7
- - /^test-.*/
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
+ 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
- rvm:
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: '10.0'
93
+ mariadb: 10.2
90
94
  env: DB=mariadb PREPARED_STATEMENTS=false
91
95
  - addons:
92
- mariadb: '10.1'
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.1.7" # 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('../lib', File.dirname(__FILE__))
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
@@ -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
- defined?(::Jdbc::MySQL.driver_name) ? ::Jdbc::MySQL.driver_name : 'com.mysql.jdbc.Driver'
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'] ||= 'convertToNull'
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] ||= 'org.mariadb.jdbc.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] ||= 'org.postgresql.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 )
@@ -1,3 +1,3 @@
1
1
  module ArJdbc
2
- VERSION = '51.3'
2
+ VERSION = '51.4'
3
3
  end
@@ -217,9 +217,11 @@ public abstract class DateTimeUtils {
217
217
  final int hours = time.getHours();
218
218
  final int minutes = time.getMinutes();
219
219
  final int seconds = time.getSeconds();
220
- final int nanos = time.getNanos(); // max 999-999-999
220
+ int nanos = time.getNanos(); // max 999-999-999
221
+ final int millis = nanos / 1000000;
222
+ nanos = nanos % 1000000;
221
223
 
222
- DateTime dateTime = new DateTime(2000, 1, 1, hours, minutes, seconds, defaultZone);
224
+ DateTime dateTime = new DateTime(2000, 1, 1, hours, minutes, seconds, millis, defaultZone);
223
225
  return RubyTime.newTime(context.runtime, dateTime, nanos);
224
226
  }
225
227
 
@@ -232,9 +234,11 @@ public abstract class DateTimeUtils {
232
234
  final int hours = timestamp.getHours();
233
235
  final int minutes = timestamp.getMinutes();
234
236
  final int seconds = timestamp.getSeconds();
235
- final int nanos = timestamp.getNanos(); // max 999-999-999
237
+ int nanos = timestamp.getNanos(); // max 999-999-999
238
+ final int millis = nanos / 1000000;
239
+ nanos = nanos % 1000000;
236
240
 
237
- DateTime dateTime = new DateTime(year, month, day, hours, minutes, seconds, 0, defaultZone);
241
+ DateTime dateTime = new DateTime(year, month, day, hours, minutes, seconds, millis, defaultZone);
238
242
  return RubyTime.newTime(context.runtime, dateTime, nanos);
239
243
  }
240
244
 
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: '51.3'
4
+ version: '51.4'
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-04-10 00:00:00.000000000 Z
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