activerecord-jdbc-alt-adapter 52.2.1-java → 52.6.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 +22 -18
- data/Gemfile +1 -1
- data/README.md +16 -14
- data/Rakefile +30 -4
- data/activerecord-jdbc-adapter.gemspec +1 -1
- data/activerecord-jdbc-alt-adapter.gemspec +2 -2
- data/lib/activerecord-jdbc-alt-adapter.rb +1 -0
- data/lib/arjdbc/abstract/core.rb +1 -1
- data/lib/arjdbc/abstract/database_statements.rb +8 -21
- data/lib/arjdbc/jdbc.rb +0 -4
- data/lib/arjdbc/jdbc/column.rb +1 -5
- data/lib/arjdbc/mssql/adapter.rb +24 -11
- data/lib/arjdbc/mssql/connection_methods.rb +5 -0
- data/lib/arjdbc/mssql/database_statements.rb +1 -1
- data/lib/arjdbc/mssql/schema_statements.rb +1 -1
- data/lib/arjdbc/mysql/connection_methods.rb +13 -7
- data/lib/arjdbc/postgresql/column.rb +6 -3
- data/lib/arjdbc/postgresql/connection_methods.rb +3 -1
- data/lib/arjdbc/sqlite3/connection_methods.rb +1 -0
- data/lib/arjdbc/version.rb +1 -1
- data/rakelib/01-tomcat.rake +2 -2
- data/rakelib/02-test.rake +0 -2
- data/rakelib/rails.rake +1 -1
- data/src/java/arjdbc/jdbc/RubyJdbcConnection.java +63 -9
- data/src/java/arjdbc/mssql/MSSQLRubyJdbcConnection.java +282 -38
- data/src/java/arjdbc/util/DateTimeUtils.java +22 -8
- metadata +7 -7
@@ -51,6 +51,9 @@ import static arjdbc.util.StringHelper.decByte;
|
|
51
51
|
* @author kares
|
52
52
|
*/
|
53
53
|
public abstract class DateTimeUtils {
|
54
|
+
|
55
|
+
private static final GJChronology CHRONO_ITALY_UTC = GJChronology.getInstance(DateTimeZone.UTC);
|
56
|
+
|
54
57
|
public static RubyTime toTime(final ThreadContext context, final IRubyObject value) {
|
55
58
|
if (!(value instanceof RubyTime)) { // unlikely
|
56
59
|
return (RubyTime) TypeConverter.convertToTypeWithCheck(value, context.runtime.getTime(), "to_time");
|
@@ -218,9 +221,11 @@ public abstract class DateTimeUtils {
|
|
218
221
|
final int hours = time.getHours();
|
219
222
|
final int minutes = time.getMinutes();
|
220
223
|
final int seconds = time.getSeconds();
|
221
|
-
|
224
|
+
int nanos = time.getNanos(); // max 999-999-999
|
225
|
+
final int millis = nanos / 1000000;
|
226
|
+
nanos = nanos % 1000000;
|
222
227
|
|
223
|
-
DateTime dateTime = new DateTime(2000, 1, 1, hours, minutes, seconds, defaultZone);
|
228
|
+
DateTime dateTime = new DateTime(2000, 1, 1, hours, minutes, seconds, millis, defaultZone);
|
224
229
|
return RubyTime.newTime(context.runtime, dateTime, nanos);
|
225
230
|
}
|
226
231
|
|
@@ -233,9 +238,11 @@ public abstract class DateTimeUtils {
|
|
233
238
|
final int hours = timestamp.getHours();
|
234
239
|
final int minutes = timestamp.getMinutes();
|
235
240
|
final int seconds = timestamp.getSeconds();
|
236
|
-
|
241
|
+
int nanos = timestamp.getNanos(); // max 999-999-999
|
242
|
+
final int millis = nanos / 1000000;
|
243
|
+
nanos = nanos % 1000000;
|
237
244
|
|
238
|
-
DateTime dateTime = new DateTime(year, month, day, hours, minutes, seconds,
|
245
|
+
DateTime dateTime = new DateTime(year, month, day, hours, minutes, seconds, millis, defaultZone);
|
239
246
|
return RubyTime.newTime(context.runtime, dateTime, nanos);
|
240
247
|
}
|
241
248
|
|
@@ -260,6 +267,15 @@ public abstract class DateTimeUtils {
|
|
260
267
|
return newDate(context, year, month, day, ISOChronology.getInstance(zone));
|
261
268
|
}
|
262
269
|
|
270
|
+
@SuppressWarnings("deprecation")
|
271
|
+
public static IRubyObject newDate(final ThreadContext context, final Date date) {
|
272
|
+
final int year = date.getYear() + 1900;
|
273
|
+
final int month = date.getMonth() + 1;
|
274
|
+
final int day = date.getDate();
|
275
|
+
|
276
|
+
return newDate(context, year, month, day, CHRONO_ITALY_UTC);
|
277
|
+
}
|
278
|
+
|
263
279
|
// @Deprecated
|
264
280
|
public static Timestamp convertToTimestamp(final RubyFloat value) {
|
265
281
|
final Timestamp timestamp = new Timestamp(value.getLongValue() * 1000); // millis
|
@@ -332,9 +348,7 @@ public abstract class DateTimeUtils {
|
|
332
348
|
|
333
349
|
if ( bcEra ) year = -1 * year; // no + 1 since we use GJChronology
|
334
350
|
|
335
|
-
|
336
|
-
final Ruby runtime = context.runtime;
|
337
|
-
return runtime.getClass("Date").newInstance(context, Java.getInstance(runtime, dateTime), Block.NULL_BLOCK);
|
351
|
+
return newDate(context, year, month, day, GJChronology.getInstance(defaultZone));
|
338
352
|
}
|
339
353
|
|
340
354
|
public static IRubyObject parseTime(final ThreadContext context, final CharSequence str, final DateTimeZone defaultZone)
|
@@ -559,7 +573,7 @@ public abstract class DateTimeUtils {
|
|
559
573
|
}
|
560
574
|
|
561
575
|
private static IRubyObject newDate(final ThreadContext context, final int year, final int month, final int day,
|
562
|
-
final
|
576
|
+
final Chronology chronology) {
|
563
577
|
// NOTE: JRuby really needs a native date.rb until than its a bit costly going from ...
|
564
578
|
// java.sql.Date -> allocating a DateTime proxy, help a bit by shooting at the internals
|
565
579
|
//
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-jdbc-alt-adapter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 52.
|
4
|
+
version: 52.6.0
|
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:
|
11
|
+
date: 2021-01-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -20,8 +20,8 @@ dependencies:
|
|
20
20
|
- !ruby/object:Gem::Version
|
21
21
|
version: 5.2.3
|
22
22
|
name: activerecord
|
23
|
-
prerelease: false
|
24
23
|
type: :runtime
|
24
|
+
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - "~>"
|
@@ -30,8 +30,8 @@ dependencies:
|
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 5.2.3
|
33
|
-
description: 'Fork of the ActiveRecord JDBC adapter with support for SQL Server
|
34
|
-
SQL, for more information and help look at the README file in the github repository.
|
33
|
+
description: 'Fork of the ActiveRecord JDBC adapter with support for SQL Server and
|
34
|
+
Azure SQL, for more information and help look at the README file in the github repository.
|
35
35
|
AR-JDBC is a database adapter for Rails'' ActiveRecord component designed to be
|
36
36
|
used with JRuby built upon Java''s JDBC API for database access. Provides (ActiveRecord)
|
37
37
|
built-in adapters: MySQL, PostgreSQL and SQLite3 as well as adapters for popular
|
@@ -76,6 +76,7 @@ files:
|
|
76
76
|
- lib/active_record/connection_adapters/sqlite3_adapter.rb
|
77
77
|
- lib/active_record/connection_adapters/sqlserver_adapter.rb
|
78
78
|
- lib/activerecord-jdbc-adapter.rb
|
79
|
+
- lib/activerecord-jdbc-alt-adapter.rb
|
79
80
|
- lib/arel/visitors/compat.rb
|
80
81
|
- lib/arel/visitors/db2.rb
|
81
82
|
- lib/arel/visitors/derby.rb
|
@@ -272,8 +273,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
272
273
|
- !ruby/object:Gem::Version
|
273
274
|
version: '0'
|
274
275
|
requirements: []
|
275
|
-
|
276
|
-
rubygems_version: 2.7.6
|
276
|
+
rubygems_version: 3.0.6
|
277
277
|
signing_key:
|
278
278
|
specification_version: 4
|
279
279
|
summary: ActiveRecord JDBC adapter, for use within JRuby on Rails and SQL Server
|