activerecord-jdbc-alt-adapter 60.1.0-java → 61.0.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/.nvimlog +0 -0
- data/.travis.yml +11 -11
- data/Gemfile +1 -1
- data/README.md +21 -17
- data/activerecord-jdbc-adapter.gemspec +2 -2
- data/activerecord-jdbc-alt-adapter.gemspec +5 -5
- data/lib/arel/visitors/postgresql_jdbc.rb +1 -1
- data/lib/arel/visitors/sqlserver.rb +16 -0
- data/lib/arjdbc/abstract/core.rb +1 -0
- data/lib/arjdbc/abstract/database_statements.rb +4 -0
- data/lib/arjdbc/abstract/transaction_support.rb +20 -7
- data/lib/arjdbc/mssql.rb +1 -1
- data/lib/arjdbc/mssql/adapter.rb +3 -1
- data/lib/arjdbc/mssql/column.rb +14 -0
- data/lib/arjdbc/mssql/database_limits.rb +7 -0
- data/lib/arjdbc/mssql/extensions/attribute_methods.rb +1 -1
- data/lib/arjdbc/mssql/schema_creation.rb +2 -2
- data/lib/arjdbc/mssql/schema_statements.rb +29 -1
- data/lib/arjdbc/mysql/adapter.rb +14 -5
- data/lib/arjdbc/mysql/connection_methods.rb +5 -1
- data/lib/arjdbc/postgresql/adapter.rb +85 -73
- data/lib/arjdbc/postgresql/column.rb +1 -1
- data/lib/arjdbc/postgresql/oid_types.rb +4 -3
- data/lib/arjdbc/sqlite3/adapter.rb +95 -58
- data/lib/arjdbc/sqlite3/connection_methods.rb +11 -1
- data/lib/arjdbc/tasks/databases.rake +15 -10
- data/lib/arjdbc/tasks/mssql_database_tasks.rb +88 -31
- data/lib/arjdbc/version.rb +3 -1
- data/src/java/arjdbc/jdbc/RubyJdbcConnection.java +106 -68
- data/src/java/arjdbc/postgresql/PostgreSQLRubyJdbcConnection.java +81 -22
- data/src/java/arjdbc/sqlite3/SQLite3RubyJdbcConnection.java +3 -4
- metadata +10 -8
@@ -197,9 +197,9 @@ public class PostgreSQLRubyJdbcConnection extends arjdbc.jdbc.RubyJdbcConnection
|
|
197
197
|
RubyClass arrayClass = oidArray(context);
|
198
198
|
RubyBasicObject attributeType = (RubyBasicObject) attributeType(context, attribute);
|
199
199
|
// The type or its delegate is an OID::Array
|
200
|
-
if (arrayClass.isInstance(attributeType) ||
|
200
|
+
if (attributeType != null && (arrayClass.isInstance(attributeType) ||
|
201
201
|
(attributeType.hasInstanceVariable("@delegate_dc_obj") &&
|
202
|
-
arrayClass.isInstance(attributeType.getInstanceVariable("@delegate_dc_obj")))) {
|
202
|
+
arrayClass.isInstance(attributeType.getInstanceVariable("@delegate_dc_obj"))))) {
|
203
203
|
return "array";
|
204
204
|
}
|
205
205
|
|
@@ -436,7 +436,7 @@ public class PostgreSQLRubyJdbcConnection extends arjdbc.jdbc.RubyJdbcConnection
|
|
436
436
|
break;
|
437
437
|
|
438
438
|
case "interval":
|
439
|
-
statement.setObject(index,
|
439
|
+
statement.setObject(index, stringToPGInterval(value.toString()));
|
440
440
|
break;
|
441
441
|
|
442
442
|
case "json":
|
@@ -493,6 +493,74 @@ public class PostgreSQLRubyJdbcConnection extends arjdbc.jdbc.RubyJdbcConnection
|
|
493
493
|
}
|
494
494
|
}
|
495
495
|
|
496
|
+
private int lookAhead(String value, int position, String find) {
|
497
|
+
char [] tokens = find.toCharArray();
|
498
|
+
int found = -1;
|
499
|
+
|
500
|
+
for ( int i = 0; i < tokens.length; i++ ) {
|
501
|
+
found = value.indexOf(tokens[i], position);
|
502
|
+
if ( found > 0 ) {
|
503
|
+
return found;
|
504
|
+
}
|
505
|
+
}
|
506
|
+
return found;
|
507
|
+
}
|
508
|
+
|
509
|
+
private Object stringToPGInterval(String value) throws SQLException {
|
510
|
+
if (!value.startsWith("P")) return new PGInterval(value);
|
511
|
+
|
512
|
+
PGInterval interval = new PGInterval();
|
513
|
+
|
514
|
+
/* this is copied from pgjdbc with fixes for Rails */
|
515
|
+
int number = 0;
|
516
|
+
String dateValue;
|
517
|
+
String timeValue = null;
|
518
|
+
|
519
|
+
int hasTime = value.indexOf('T');
|
520
|
+
if ( hasTime > 0 ) {
|
521
|
+
/* skip over the P */
|
522
|
+
dateValue = value.substring(1,hasTime);
|
523
|
+
timeValue = value.substring(hasTime + 1);
|
524
|
+
} else {
|
525
|
+
/* skip over the P */
|
526
|
+
dateValue = value.substring(1);
|
527
|
+
}
|
528
|
+
|
529
|
+
for ( int i = 0; i < dateValue.length(); i++ ) {
|
530
|
+
int lookAhead = lookAhead(dateValue, i, "YMD");
|
531
|
+
if (lookAhead > 0) {
|
532
|
+
char type = dateValue.charAt(lookAhead);
|
533
|
+
number = Integer.parseInt(dateValue.substring(i, lookAhead));
|
534
|
+
if (type == 'Y') {
|
535
|
+
interval.setYears(number);
|
536
|
+
} else if (type == 'M') {
|
537
|
+
interval.setMonths(number);
|
538
|
+
} else if (type == 'D') {
|
539
|
+
interval.setDays(number);
|
540
|
+
}
|
541
|
+
i = lookAhead;
|
542
|
+
}
|
543
|
+
}
|
544
|
+
if ( timeValue != null ) {
|
545
|
+
for (int i = 0; i < timeValue.length(); i++) {
|
546
|
+
int lookAhead = lookAhead(timeValue, i, "HMS");
|
547
|
+
if (lookAhead > 0) {
|
548
|
+
char type = timeValue.charAt(lookAhead);
|
549
|
+
String part = timeValue.substring(i, lookAhead);
|
550
|
+
if (timeValue.charAt(lookAhead) == 'H') {
|
551
|
+
interval.setHours(Integer.parseInt(part));
|
552
|
+
} else if (timeValue.charAt(lookAhead) == 'M') {
|
553
|
+
interval.setMinutes(Integer.parseInt(part));
|
554
|
+
} else if (timeValue.charAt(lookAhead) == 'S') {
|
555
|
+
interval.setSeconds(Double.parseDouble(part));
|
556
|
+
}
|
557
|
+
i = lookAhead;
|
558
|
+
}
|
559
|
+
}
|
560
|
+
}
|
561
|
+
return interval;
|
562
|
+
}
|
563
|
+
|
496
564
|
protected IRubyObject jdbcToRuby(ThreadContext context, Ruby runtime, int column, int type, ResultSet resultSet) throws SQLException {
|
497
565
|
return typeMap != null ?
|
498
566
|
convertWithTypeMap(context, runtime, column, type, resultSet) :
|
@@ -874,34 +942,25 @@ public class PostgreSQLRubyJdbcConnection extends arjdbc.jdbc.RubyJdbcConnection
|
|
874
942
|
private static String formatInterval(final Object object) {
|
875
943
|
final PGInterval interval = (PGInterval) object;
|
876
944
|
final StringBuilder str = new StringBuilder(32);
|
945
|
+
str.append("P");
|
877
946
|
|
878
947
|
final int years = interval.getYears();
|
879
|
-
if (years != 0) str.append(years).append("
|
948
|
+
if (years != 0) str.append(years).append("Y");
|
880
949
|
|
881
950
|
final int months = interval.getMonths();
|
882
|
-
if (months != 0) str.append(months).append("
|
951
|
+
if (months != 0) str.append(months).append("M");
|
883
952
|
|
884
953
|
final int days = interval.getDays();
|
885
|
-
if (days != 0) str.append(days).append("
|
954
|
+
if (days != 0) str.append(days).append("D");
|
886
955
|
|
887
956
|
final int hours = interval.getHours();
|
888
957
|
final int mins = interval.getMinutes();
|
889
|
-
final
|
890
|
-
if (hours != 0 || mins != 0 || secs != 0) {
|
891
|
-
|
892
|
-
|
893
|
-
str.append(
|
894
|
-
|
895
|
-
if (mins < 10) str.append('0');
|
896
|
-
|
897
|
-
str.append(mins).append(':');
|
898
|
-
|
899
|
-
if (secs < 10) str.append('0');
|
900
|
-
|
901
|
-
str.append(secs);
|
902
|
-
|
903
|
-
} else if (str.length() > 1) {
|
904
|
-
str.deleteCharAt(str.length() - 1); // " " at the end
|
958
|
+
final double secs = interval.getSeconds();
|
959
|
+
if (hours != 0 || mins != 0 || secs != 0) {
|
960
|
+
str.append("T");
|
961
|
+
if (hours != 0) str.append(hours).append("H");
|
962
|
+
if (mins != 0) str.append(mins).append("M");
|
963
|
+
if (secs != 0) str.append(secs).append("S");
|
905
964
|
}
|
906
965
|
|
907
966
|
return str.toString();
|
@@ -370,10 +370,9 @@ public class SQLite3RubyJdbcConnection extends RubyJdbcConnection {
|
|
370
370
|
}
|
371
371
|
|
372
372
|
@Override
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
);
|
373
|
+
protected boolean resetSavepoints(final ThreadContext context, final Connection connection) throws SQLException {
|
374
|
+
connection.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);
|
375
|
+
return super.resetSavepoints(context, connection);
|
377
376
|
}
|
378
377
|
|
379
378
|
@Override
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-jdbc-alt-adapter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 61.0.0
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
|
-
- Nick Sieger, Ola Bini, Karol Bucek and JRuby contributors
|
7
|
+
- Nick Sieger, Ola Bini, Karol Bucek, Jesse Chavez, and JRuby contributors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
15
15
|
requirements:
|
16
16
|
- - "~>"
|
17
17
|
- !ruby/object:Gem::Version
|
18
|
-
version: 6.
|
18
|
+
version: 6.1.0
|
19
19
|
name: activerecord
|
20
|
-
type: :runtime
|
21
20
|
prerelease: false
|
21
|
+
type: :runtime
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 6.
|
26
|
+
version: 6.1.0
|
27
27
|
description: 'Fork of the ActiveRecord JDBC adapter with support for SQL Server and
|
28
28
|
Azure SQL, for more information and help look at the README file in the github repository.
|
29
29
|
AR-JDBC is a database adapter for Rails'' ActiveRecord component designed to be
|
@@ -33,11 +33,13 @@ email:
|
|
33
33
|
- nick@nicksieger.com
|
34
34
|
- ola.bini@gmail.com
|
35
35
|
- self@kares.org
|
36
|
+
- jesse.chavez.r@gmail.com
|
36
37
|
executables: []
|
37
38
|
extensions: []
|
38
39
|
extra_rdoc_files: []
|
39
40
|
files:
|
40
41
|
- ".gitignore"
|
42
|
+
- ".nvimlog"
|
41
43
|
- ".travis.yml"
|
42
44
|
- ".yardopts"
|
43
45
|
- CONTRIBUTING.md
|
@@ -248,7 +250,7 @@ post_install_message:
|
|
248
250
|
rdoc_options:
|
249
251
|
- "--main"
|
250
252
|
- README.md
|
251
|
-
- "-
|
253
|
+
- "-HN"
|
252
254
|
- "-f"
|
253
255
|
- darkfish
|
254
256
|
require_paths:
|
@@ -264,7 +266,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
264
266
|
- !ruby/object:Gem::Version
|
265
267
|
version: '0'
|
266
268
|
requirements: []
|
267
|
-
rubygems_version: 3.
|
269
|
+
rubygems_version: 3.1.6
|
268
270
|
signing_key:
|
269
271
|
specification_version: 4
|
270
272
|
summary: ActiveRecord JDBC adapter, for use within JRuby on Rails and SQL Server
|