activerecord-jdbc-adapter 50.3-java → 50.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: fde4f57b66b6cae2acbbac6eba863c7423ed320b2e420b7a752ec8a9eb984846
4
- data.tar.gz: e3a689f005016305b9e3e2b6c637fcd948135d821381d216007ba8a5a3a0eb50
3
+ metadata.gz: 0eb637ab4fc2be9696742922d8dd2ca312ccec9d663a445aa653b974210e5de8
4
+ data.tar.gz: 9b1899320c394343bbbd105a6268fdcb79f2e9e1574be0d171a42433fd4296c3
5
5
  SHA512:
6
- metadata.gz: f55d6fbeecc3cc27ea2d5c8af4e31cb84c3ef82f8ea22d536772e61524798a89c2f88bf88dd09d97bd5c5fa3aeca45dc8fa21a4883fb5a4e8e80b6d98cac3d14
7
- data.tar.gz: 8fb21f6c9c0f0919ed8215781329b3a8ecc012399593332c9a56432542d88036dbb36e05d6b6ddc5aa7c2b06d4df45035693c694a40ec71ce37834ca2bf68a57
6
+ metadata.gz: 43f434cadfb9913aa3acec15b70d7044c58ffcdb806f3f97b197b3888e268c5403574cf891a0bb28ecdb390c275dda0a1e6a1440b062386e005bffcc9d7b9a79
7
+ data.tar.gz: 247c847013a86078ae01bd67b9e6c304d1af64c8ae48009ab941b1aebea0d6d8ce0ead3b638969c19ff391ffe380aeb0f17789750da5eb84f442e65d711cfeb0
@@ -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.0.7.1" # 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 = '50.3'
2
+ VERSION = '50.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: '50.3'
4
+ version: '50.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