activerecord-jdbc-adapter 51.7-java → 52.0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -2
- data/.travis.yml +26 -51
- data/README.md +9 -11
- data/Rakefile +19 -74
- data/activerecord-jdbc-adapter.gemspec +2 -2
- data/lib/active_record/connection_adapters/mssql_adapter.rb +1 -0
- data/lib/active_record/connection_adapters/sqlserver_adapter.rb +1 -0
- data/lib/arjdbc/abstract/core.rb +2 -12
- data/lib/arjdbc/abstract/database_statements.rb +24 -10
- data/lib/arjdbc/abstract/statement_cache.rb +4 -4
- data/lib/arjdbc/db2/adapter.rb +52 -2
- data/lib/arjdbc/jdbc.rb +4 -0
- data/lib/arjdbc/jdbc/column.rb +11 -5
- data/lib/arjdbc/jdbc/connection_methods.rb +9 -2
- data/lib/arjdbc/jdbc/jdbc.rake +4 -0
- data/lib/arjdbc/mssql.rb +7 -0
- data/lib/arjdbc/mssql/adapter.rb +804 -0
- data/lib/arjdbc/mssql/column.rb +200 -0
- data/lib/arjdbc/mssql/connection_methods.rb +79 -0
- data/lib/arjdbc/mssql/explain_support.rb +99 -0
- data/lib/arjdbc/mssql/limit_helpers.rb +231 -0
- data/lib/arjdbc/mssql/lock_methods.rb +77 -0
- data/lib/arjdbc/mssql/types.rb +343 -0
- data/lib/arjdbc/mssql/utils.rb +82 -0
- data/lib/arjdbc/mysql/adapter.rb +22 -14
- data/lib/arjdbc/mysql/connection_methods.rb +9 -18
- data/lib/arjdbc/postgresql/adapter.rb +102 -75
- data/lib/arjdbc/postgresql/column.rb +3 -6
- data/lib/arjdbc/postgresql/connection_methods.rb +3 -12
- data/lib/arjdbc/postgresql/oid_types.rb +12 -86
- data/lib/arjdbc/sqlite3/adapter.rb +88 -92
- data/lib/arjdbc/sqlite3/connection_methods.rb +0 -1
- data/lib/arjdbc/tasks/database_tasks.rb +36 -16
- data/lib/arjdbc/tasks/databases.rake +75 -32
- data/lib/arjdbc/tasks/databases3.rake +215 -0
- data/lib/arjdbc/tasks/databases4.rake +39 -0
- data/lib/arjdbc/version.rb +1 -1
- data/rakelib/01-tomcat.rake +2 -2
- data/rakelib/02-test.rake +3 -0
- data/rakelib/compile.rake +70 -0
- data/rakelib/db.rake +7 -21
- data/rakelib/rails.rake +4 -5
- data/src/java/arjdbc/ArJdbcModule.java +15 -5
- data/src/java/arjdbc/derby/DerbyRubyJdbcConnection.java +2 -2
- data/src/java/arjdbc/jdbc/ConnectionFactory.java +87 -0
- data/src/java/arjdbc/jdbc/DataSourceConnectionFactory.java +1 -0
- data/src/java/arjdbc/jdbc/RubyJdbcConnection.java +29 -113
- data/src/java/arjdbc/mssql/MSSQLRubyJdbcConnection.java +14 -259
- data/src/java/arjdbc/mysql/MySQLRubyJdbcConnection.java +2 -2
- data/src/java/arjdbc/postgresql/PgResultSetMetaDataWrapper.java +23 -0
- data/src/java/arjdbc/postgresql/PostgreSQLResult.java +13 -21
- data/src/java/arjdbc/postgresql/PostgreSQLRubyJdbcConnection.java +50 -44
- data/src/java/arjdbc/util/DateTimeUtils.java +5 -141
- data/src/java/arjdbc/util/QuotingUtils.java +7 -6
- metadata +26 -11
- data/src/java/arjdbc/jdbc/RubyConnectionFactory.java +0 -61
- data/src/java/arjdbc/postgresql/PgDateTimeUtils.java +0 -52
@@ -55,7 +55,6 @@ import org.joda.time.DateTimeZone;
|
|
55
55
|
import org.jruby.*;
|
56
56
|
import org.jruby.anno.JRubyMethod;
|
57
57
|
import org.jruby.exceptions.RaiseException;
|
58
|
-
import org.jruby.ext.bigdecimal.RubyBigDecimal;
|
59
58
|
import org.jruby.javasupport.JavaUtil;
|
60
59
|
import org.jruby.runtime.ObjectAllocator;
|
61
60
|
import org.jruby.runtime.ThreadContext;
|
@@ -101,7 +100,6 @@ public class PostgreSQLRubyJdbcConnection extends arjdbc.jdbc.RubyJdbcConnection
|
|
101
100
|
POSTGRES_JDBC_TYPE_FOR.put("line", Types.OTHER);
|
102
101
|
POSTGRES_JDBC_TYPE_FOR.put("lseg", Types.OTHER);
|
103
102
|
POSTGRES_JDBC_TYPE_FOR.put("ltree", Types.OTHER);
|
104
|
-
POSTGRES_JDBC_TYPE_FOR.put("money", Types.OTHER);
|
105
103
|
POSTGRES_JDBC_TYPE_FOR.put("numrange", Types.OTHER);
|
106
104
|
POSTGRES_JDBC_TYPE_FOR.put("path", Types.OTHER);
|
107
105
|
POSTGRES_JDBC_TYPE_FOR.put("point", Types.OTHER);
|
@@ -282,30 +280,6 @@ public class PostgreSQLRubyJdbcConnection extends arjdbc.jdbc.RubyJdbcConnection
|
|
282
280
|
return mapExecuteResult(context, connection, resultSet).toARResult(context);
|
283
281
|
}
|
284
282
|
|
285
|
-
@Override
|
286
|
-
protected void setArrayParameter(final ThreadContext context,
|
287
|
-
final Connection connection, final PreparedStatement statement,
|
288
|
-
final int index, final IRubyObject value,
|
289
|
-
final IRubyObject attribute, final int type) throws SQLException {
|
290
|
-
|
291
|
-
final String typeName = resolveArrayBaseTypeName(context, attribute);
|
292
|
-
final RubyArray valueForDB = (RubyArray) value.callMethod(context, "values");
|
293
|
-
|
294
|
-
Object[] values;
|
295
|
-
switch (typeName) {
|
296
|
-
case "datetime":
|
297
|
-
case "timestamp": {
|
298
|
-
values = PgDateTimeUtils.timestampStringArray(context, valueForDB);
|
299
|
-
break;
|
300
|
-
}
|
301
|
-
default:
|
302
|
-
values = valueForDB.toArray();
|
303
|
-
break;
|
304
|
-
}
|
305
|
-
|
306
|
-
statement.setArray(index, connection.createArrayOf(typeName, values));
|
307
|
-
}
|
308
|
-
|
309
283
|
@Override
|
310
284
|
protected void setBlobParameter(final ThreadContext context,
|
311
285
|
final Connection connection, final PreparedStatement statement,
|
@@ -329,9 +303,47 @@ public class PostgreSQLRubyJdbcConnection extends arjdbc.jdbc.RubyJdbcConnection
|
|
329
303
|
final Connection connection, final PreparedStatement statement,
|
330
304
|
final int index, IRubyObject value,
|
331
305
|
final IRubyObject attribute, final int type) throws SQLException {
|
332
|
-
|
333
|
-
|
334
|
-
|
306
|
+
|
307
|
+
if ( value instanceof RubyFloat ) {
|
308
|
+
final double doubleValue = ( (RubyFloat) value ).getValue();
|
309
|
+
if ( Double.isInfinite(doubleValue) ) {
|
310
|
+
setTimestampInfinity(statement, index, doubleValue);
|
311
|
+
return;
|
312
|
+
}
|
313
|
+
}
|
314
|
+
|
315
|
+
RubyTime timeValue = toTime(context, value);
|
316
|
+
|
317
|
+
final Timestamp timestamp;
|
318
|
+
|
319
|
+
if (timeValue.getDateTime().getYear() > 0) {
|
320
|
+
timeValue = timeInDefaultTimeZone(context, timeValue);
|
321
|
+
DateTime dateTime = timeValue.getDateTime();
|
322
|
+
timestamp = new Timestamp(dateTime.getMillis());
|
323
|
+
|
324
|
+
if (timeValue.getNSec() > 0) timestamp.setNanos((int) (timestamp.getNanos() + timeValue.getNSec()));
|
325
|
+
|
326
|
+
statement.setTimestamp(index, timestamp, getCalendar(dateTime.getZone()));
|
327
|
+
}
|
328
|
+
else {
|
329
|
+
setTimestampBC(statement, index, timeValue);
|
330
|
+
}
|
331
|
+
}
|
332
|
+
|
333
|
+
private static void setTimestampBC(final PreparedStatement statement,
|
334
|
+
final int index, final RubyTime timeValue) throws SQLException {
|
335
|
+
DateTime dateTime = timeValue.getDateTime();
|
336
|
+
@SuppressWarnings("deprecated")
|
337
|
+
Timestamp timestamp = new Timestamp(dateTime.getYear() - 1900,
|
338
|
+
dateTime.getMonthOfYear() - 1,
|
339
|
+
dateTime.getDayOfMonth(),
|
340
|
+
dateTime.getHourOfDay(),
|
341
|
+
dateTime.getMinuteOfHour(),
|
342
|
+
dateTime.getSecondOfMinute(),
|
343
|
+
dateTime.getMillisOfSecond() * 1_000_000 + (int) timeValue.getNSec()
|
344
|
+
);
|
345
|
+
|
346
|
+
statement.setObject(index, timestamp);
|
335
347
|
}
|
336
348
|
|
337
349
|
private static void setTimestampInfinity(final PreparedStatement statement,
|
@@ -353,8 +365,7 @@ public class PostgreSQLRubyJdbcConnection extends arjdbc.jdbc.RubyJdbcConnection
|
|
353
365
|
final int index, IRubyObject value,
|
354
366
|
final IRubyObject attribute, final int type) throws SQLException {
|
355
367
|
// to handle more fractional second precision than (default) 59.123 only
|
356
|
-
|
357
|
-
statement.setObject(index, timeStr, Types.OTHER);
|
368
|
+
super.setTimestampParameter(context, connection, statement, index, value, attribute, type);
|
358
369
|
}
|
359
370
|
|
360
371
|
@Override
|
@@ -408,7 +419,8 @@ public class PostgreSQLRubyJdbcConnection extends arjdbc.jdbc.RubyJdbcConnection
|
|
408
419
|
break;
|
409
420
|
|
410
421
|
case "enum":
|
411
|
-
|
422
|
+
// FIXME: This doesn't work but it gives a better error message than letting it be treated as a PGobject
|
423
|
+
statement.setObject(index, value.toString());
|
412
424
|
break;
|
413
425
|
|
414
426
|
case "interval":
|
@@ -429,14 +441,6 @@ public class PostgreSQLRubyJdbcConnection extends arjdbc.jdbc.RubyJdbcConnection
|
|
429
441
|
}
|
430
442
|
break;
|
431
443
|
|
432
|
-
case "money":
|
433
|
-
if (value instanceof RubyBigDecimal) {
|
434
|
-
statement.setBigDecimal(index, ((RubyBigDecimal) value).getValue());
|
435
|
-
} else {
|
436
|
-
setPGobjectParameter(statement, index, value, columnType);
|
437
|
-
}
|
438
|
-
break;
|
439
|
-
|
440
444
|
case "lseg":
|
441
445
|
pointValues = parseDoubles(value);
|
442
446
|
statement.setObject(index, new PGlseg(pointValues[0], pointValues[1], pointValues[2], pointValues[3]));
|
@@ -515,7 +519,9 @@ public class PostgreSQLRubyJdbcConnection extends arjdbc.jdbc.RubyJdbcConnection
|
|
515
519
|
final PreparedStatement statement, final int index,
|
516
520
|
final IRubyObject value, final String columnType) throws SQLException {
|
517
521
|
|
518
|
-
|
522
|
+
// As of AR 5.2 this is a Range object, I defer to the adapter for encoding because of the edge cases
|
523
|
+
// of dealing with the specific types in the range
|
524
|
+
final String rangeValue = adapter(context).callMethod(context, "encode_range", value).toString();
|
519
525
|
final Object pgRange;
|
520
526
|
|
521
527
|
switch ( columnType ) {
|
@@ -535,7 +541,7 @@ public class PostgreSQLRubyJdbcConnection extends arjdbc.jdbc.RubyJdbcConnection
|
|
535
541
|
pgRange = new Int8RangeType(rangeValue);
|
536
542
|
break;
|
537
543
|
default:
|
538
|
-
pgRange = new NumRangeType(rangeValue);
|
544
|
+
pgRange = new NumRangeType(rangeValue, columnType);
|
539
545
|
}
|
540
546
|
|
541
547
|
statement.setObject(index, pgRange);
|
@@ -939,8 +945,8 @@ public class PostgreSQLRubyJdbcConnection extends arjdbc.jdbc.RubyJdbcConnection
|
|
939
945
|
setType("numrange");
|
940
946
|
}
|
941
947
|
|
942
|
-
public NumRangeType(final String value) throws SQLException {
|
943
|
-
|
948
|
+
public NumRangeType(final String value, final String type) throws SQLException {
|
949
|
+
setType(type);
|
944
950
|
setValue(value);
|
945
951
|
}
|
946
952
|
|
@@ -28,10 +28,8 @@ import java.sql.Time;
|
|
28
28
|
import java.sql.Timestamp;
|
29
29
|
import java.util.TimeZone;
|
30
30
|
|
31
|
-
import org.joda.time.Chronology;
|
32
31
|
import org.joda.time.DateTime;
|
33
32
|
import org.joda.time.DateTimeZone;
|
34
|
-
import org.joda.time.chrono.GJChronology;
|
35
33
|
import org.joda.time.chrono.ISOChronology;
|
36
34
|
import org.jruby.Ruby;
|
37
35
|
import org.jruby.RubyFloat;
|
@@ -42,7 +40,6 @@ import org.jruby.runtime.Block;
|
|
42
40
|
import org.jruby.runtime.ThreadContext;
|
43
41
|
import org.jruby.runtime.builtin.IRubyObject;
|
44
42
|
import org.jruby.util.ByteList;
|
45
|
-
import org.jruby.util.TypeConverter;
|
46
43
|
|
47
44
|
import static arjdbc.util.StringHelper.decByte;
|
48
45
|
|
@@ -52,20 +49,6 @@ import static arjdbc.util.StringHelper.decByte;
|
|
52
49
|
*/
|
53
50
|
public abstract class DateTimeUtils {
|
54
51
|
|
55
|
-
private static final GJChronology CHRONO_ITALY_UTC = GJChronology.getInstance(DateTimeZone.UTC);
|
56
|
-
|
57
|
-
public static RubyTime toTime(final ThreadContext context, final IRubyObject value) {
|
58
|
-
if (!(value instanceof RubyTime)) { // unlikely
|
59
|
-
return (RubyTime) TypeConverter.convertToTypeWithCheck(value, context.runtime.getTime(), "to_time");
|
60
|
-
}
|
61
|
-
return (RubyTime) value;
|
62
|
-
}
|
63
|
-
|
64
|
-
public static DateTime dateTimeInZone(final DateTime dateTime, final DateTimeZone zone) {
|
65
|
-
if (zone == dateTime.getZone()) return dateTime;
|
66
|
-
return dateTime.withZone(zone);
|
67
|
-
}
|
68
|
-
|
69
52
|
@SuppressWarnings("deprecation")
|
70
53
|
public static ByteList timeToString(final Time time) {
|
71
54
|
final ByteList str = new ByteList(8); // hh:mm:ss
|
@@ -221,11 +204,9 @@ public abstract class DateTimeUtils {
|
|
221
204
|
final int hours = time.getHours();
|
222
205
|
final int minutes = time.getMinutes();
|
223
206
|
final int seconds = time.getSeconds();
|
224
|
-
int nanos = time.getNanos(); // max 999-999-999
|
225
|
-
final int millis = nanos / 1000000;
|
226
|
-
nanos = nanos % 1000000;
|
207
|
+
final int nanos = time.getNanos(); // max 999-999-999
|
227
208
|
|
228
|
-
DateTime dateTime = new DateTime(2000, 1, 1, hours, minutes, seconds,
|
209
|
+
DateTime dateTime = new DateTime(2000, 1, 1, hours, minutes, seconds, defaultZone);
|
229
210
|
return RubyTime.newTime(context.runtime, dateTime, nanos);
|
230
211
|
}
|
231
212
|
|
@@ -238,11 +219,9 @@ public abstract class DateTimeUtils {
|
|
238
219
|
final int hours = timestamp.getHours();
|
239
220
|
final int minutes = timestamp.getMinutes();
|
240
221
|
final int seconds = timestamp.getSeconds();
|
241
|
-
int nanos = timestamp.getNanos(); // max 999-999-999
|
242
|
-
final int millis = nanos / 1000000;
|
243
|
-
nanos = nanos % 1000000;
|
222
|
+
final int nanos = timestamp.getNanos(); // max 999-999-999
|
244
223
|
|
245
|
-
DateTime dateTime = new DateTime(year, month, day, hours, minutes, seconds,
|
224
|
+
DateTime dateTime = new DateTime(year, month, day, hours, minutes, seconds, 0, defaultZone);
|
246
225
|
return RubyTime.newTime(context.runtime, dateTime, nanos);
|
247
226
|
}
|
248
227
|
|
@@ -267,15 +246,6 @@ public abstract class DateTimeUtils {
|
|
267
246
|
return newDate(context, year, month, day, ISOChronology.getInstance(zone));
|
268
247
|
}
|
269
248
|
|
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
|
-
|
279
249
|
// @Deprecated
|
280
250
|
public static Timestamp convertToTimestamp(final RubyFloat value) {
|
281
251
|
final Timestamp timestamp = new Timestamp(value.getLongValue() * 1000); // millis
|
@@ -570,7 +540,7 @@ public abstract class DateTimeUtils {
|
|
570
540
|
}
|
571
541
|
|
572
542
|
private static IRubyObject newDate(final ThreadContext context, final int year, final int month, final int day,
|
573
|
-
final
|
543
|
+
final ISOChronology chronology) {
|
574
544
|
// NOTE: JRuby really needs a native date.rb until than its a bit costly going from ...
|
575
545
|
// java.sql.Date -> allocating a DateTime proxy, help a bit by shooting at the internals
|
576
546
|
//
|
@@ -607,110 +577,4 @@ public abstract class DateTimeUtils {
|
|
607
577
|
return n;
|
608
578
|
}
|
609
579
|
|
610
|
-
|
611
|
-
private static final char[] ZEROS = {'0', '0', '0', '0', '0', '0'};
|
612
|
-
private static final char[][] NUMBERS;
|
613
|
-
|
614
|
-
static {
|
615
|
-
// maximum value is 60 (seconds)
|
616
|
-
NUMBERS = new char[60][];
|
617
|
-
for (int i = 0; i < NUMBERS.length; i++) {
|
618
|
-
NUMBERS[i] = ((i < 10 ? "0" : "") + Integer.toString(i)).toCharArray();
|
619
|
-
}
|
620
|
-
}
|
621
|
-
|
622
|
-
/**
|
623
|
-
* Converts a ruby timestamp to a java string, optionally with timezone and timezone adjustment
|
624
|
-
* @param context
|
625
|
-
* @param value the ruby value, typically a Time
|
626
|
-
* @param zone DateTimeZone to adjust to, optional
|
627
|
-
* @param withZone include timezone in the string?
|
628
|
-
* @return timestamp as string
|
629
|
-
*/
|
630
|
-
public static String timestampTimeToString(final ThreadContext context,
|
631
|
-
final IRubyObject value, DateTimeZone zone, boolean withZone) {
|
632
|
-
RubyTime timeValue = toTime(context, value);
|
633
|
-
DateTime dt = timeValue.getDateTime();
|
634
|
-
|
635
|
-
StringBuilder sb = new StringBuilder(36);
|
636
|
-
|
637
|
-
int year = dt.getYear();
|
638
|
-
if (year <= 0) {
|
639
|
-
year--;
|
640
|
-
} else if (zone != null) {
|
641
|
-
dt = dateTimeInZone(dt, zone);
|
642
|
-
year = dt.getYear();
|
643
|
-
}
|
644
|
-
|
645
|
-
Chronology chrono = dt.getChronology();
|
646
|
-
long millis = dt.getMillis();
|
647
|
-
|
648
|
-
// always use 4 digits for year to avoid short dates being misinterpreted
|
649
|
-
sb.append(Math.abs(year));
|
650
|
-
int lead = 4 - sb.length();
|
651
|
-
if (lead > 0) sb.insert(0, ZEROS, 0, lead);
|
652
|
-
sb.append('-');
|
653
|
-
sb.append(NUMBERS[chrono.monthOfYear().get(millis)]);
|
654
|
-
sb.append('-');
|
655
|
-
sb.append(NUMBERS[chrono.dayOfMonth().get(millis)]);
|
656
|
-
if (year < 0) sb.append(" BC");
|
657
|
-
sb.append(' ');
|
658
|
-
|
659
|
-
appendTime(sb, chrono, millis, (int) timeValue.getUSec(), withZone);
|
660
|
-
|
661
|
-
return sb.toString();
|
662
|
-
}
|
663
|
-
|
664
|
-
/**
|
665
|
-
* Converts a ruby time to a java string, optionally with timezone and timezone adjustment
|
666
|
-
* @param context
|
667
|
-
* @param value the ruby value, typically a Time
|
668
|
-
* @param zone DateTimeZone to adjust to, optional
|
669
|
-
* @param withZone include timezone in the string?
|
670
|
-
* @return time as string
|
671
|
-
*/
|
672
|
-
public static String timeString(final ThreadContext context,
|
673
|
-
final IRubyObject value, DateTimeZone zone, boolean withZone) {
|
674
|
-
StringBuilder sb = new StringBuilder(21);
|
675
|
-
RubyTime timeValue = toTime(context, value);
|
676
|
-
DateTime dt = timeValue.getDateTime();
|
677
|
-
if (zone != null) dt = dateTimeInZone(dt, zone);
|
678
|
-
|
679
|
-
appendTime(sb, dt.getChronology(), dt.getMillis(), (int) timeValue.getUSec(), withZone);
|
680
|
-
return sb.toString();
|
681
|
-
}
|
682
|
-
|
683
|
-
private static void appendTime(StringBuilder sb, Chronology chrono,
|
684
|
-
long millis, int usec, boolean withZone) {
|
685
|
-
sb.append(NUMBERS[chrono.hourOfDay().get(millis)]);
|
686
|
-
sb.append(':');
|
687
|
-
sb.append(NUMBERS[chrono.minuteOfHour().get(millis)]);
|
688
|
-
sb.append(':');
|
689
|
-
sb.append(NUMBERS[chrono.secondOfMinute().get(millis)]);
|
690
|
-
|
691
|
-
// PG has microsecond resolution. Change when nanos are required
|
692
|
-
int micros = chrono.millisOfSecond().get(millis) * 1000 + usec;
|
693
|
-
if (micros > 0) {
|
694
|
-
sb.append('.');
|
695
|
-
|
696
|
-
int len = sb.length();
|
697
|
-
sb.append(micros);
|
698
|
-
int lead = 6 - (sb.length() - len);
|
699
|
-
if (lead > 0) sb.insert(len, ZEROS, 0, lead);
|
700
|
-
|
701
|
-
for (int end = sb.length() - 1; sb.charAt(end) == '0'; end--) {
|
702
|
-
sb.setLength(end);
|
703
|
-
}
|
704
|
-
}
|
705
|
-
|
706
|
-
if (withZone) {
|
707
|
-
int offset = chrono.getZone().getOffset(millis) / 1000;
|
708
|
-
int absoff = Math.abs(offset);
|
709
|
-
int hours = absoff / 3600;
|
710
|
-
int mins = (absoff - hours * 3600) / 60;
|
711
|
-
|
712
|
-
sb.append(offset < 0 ? '-' : '+');
|
713
|
-
sb.append(NUMBERS[hours]).append(':').append(NUMBERS[mins]);
|
714
|
-
}
|
715
|
-
}
|
716
580
|
}
|
@@ -52,6 +52,7 @@ public abstract class QuotingUtils {
|
|
52
52
|
return quoteCharWith(context, string, value, quote, 0, 8);
|
53
53
|
}
|
54
54
|
|
55
|
+
@SuppressWarnings("deprecation")
|
55
56
|
public static RubyString quoteCharWith(
|
56
57
|
final ThreadContext context,
|
57
58
|
final RubyString string,
|
@@ -71,8 +72,8 @@ public abstract class QuotingUtils {
|
|
71
72
|
new byte[realSize + newOffset + newSizeDiff],
|
72
73
|
stringBytes.getEncoding(), false
|
73
74
|
);
|
74
|
-
quotedBytes.
|
75
|
-
quotedBytes.
|
75
|
+
quotedBytes.begin = newOffset;
|
76
|
+
quotedBytes.realSize = 0;
|
76
77
|
}
|
77
78
|
quotedBytes.append(bytes, appendFrom, i - appendFrom);
|
78
79
|
quotedBytes.append(quote).append(value); // e.g. "'" => "''"
|
@@ -87,6 +88,7 @@ public abstract class QuotingUtils {
|
|
87
88
|
return context.runtime.newString(quotedBytes);
|
88
89
|
}
|
89
90
|
|
91
|
+
@SuppressWarnings("deprecation")
|
90
92
|
public static RubyString quoteCharAndDecorateWith(
|
91
93
|
final ThreadContext context, final RubyString string,
|
92
94
|
final char value, final char quote,
|
@@ -100,7 +102,7 @@ public abstract class QuotingUtils {
|
|
100
102
|
final ByteList quoted = new ByteList(
|
101
103
|
new byte[realSize + 2], string.getEncoding(), false
|
102
104
|
);
|
103
|
-
quoted.
|
105
|
+
quoted.begin = 0; quoted.realSize = 0;
|
104
106
|
quoted.append(prefix);
|
105
107
|
quoted.append(str.unsafeBytes(), str.getBegin(), realSize);
|
106
108
|
quoted.append(suffix);
|
@@ -108,9 +110,8 @@ public abstract class QuotingUtils {
|
|
108
110
|
}
|
109
111
|
// we got a new string with a reserve of 1 byte front and back :
|
110
112
|
final ByteList quoted = quotedString.getByteList();
|
111
|
-
quoted.
|
112
|
-
quoted.
|
113
|
-
quoted.setRealSize(quoted.getRealSize() + 1);
|
113
|
+
quoted.begin = 0; // setBegin invalidates
|
114
|
+
quoted.bytes[0] = prefix; quoted.realSize++;
|
114
115
|
quoted.append(suffix);
|
115
116
|
return quotedString;
|
116
117
|
}
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-jdbc-adapter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '
|
4
|
+
version: '52.0'
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Nick Sieger, Ola Bini, Karol Bucek and JRuby contributors
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
+
name: activerecord
|
14
15
|
requirement: !ruby/object:Gem::Requirement
|
15
16
|
requirements:
|
16
17
|
- - "~>"
|
17
18
|
- !ruby/object:Gem::Version
|
18
|
-
version: 5.
|
19
|
-
name: activerecord
|
19
|
+
version: 5.2.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 5.
|
26
|
+
version: 5.2.0
|
27
27
|
description: 'AR-JDBC is a database adapter for Rails'' ActiveRecord component designed
|
28
28
|
to be used with JRuby built upon Java''s JDBC API for database access. Provides
|
29
29
|
(ActiveRecord) built-in adapters: MySQL, PostgreSQL and SQLite3 as well as adapters
|
@@ -60,10 +60,12 @@ files:
|
|
60
60
|
- lib/active_record/connection_adapters/jdbc_adapter.rb
|
61
61
|
- lib/active_record/connection_adapters/jndi_adapter.rb
|
62
62
|
- lib/active_record/connection_adapters/mariadb_adapter.rb
|
63
|
+
- lib/active_record/connection_adapters/mssql_adapter.rb
|
63
64
|
- lib/active_record/connection_adapters/mysql2_adapter.rb
|
64
65
|
- lib/active_record/connection_adapters/mysql_adapter.rb
|
65
66
|
- lib/active_record/connection_adapters/postgresql_adapter.rb
|
66
67
|
- lib/active_record/connection_adapters/sqlite3_adapter.rb
|
68
|
+
- lib/active_record/connection_adapters/sqlserver_adapter.rb
|
67
69
|
- lib/activerecord-jdbc-adapter.rb
|
68
70
|
- lib/arel/visitors/compat.rb
|
69
71
|
- lib/arel/visitors/db2.rb
|
@@ -117,11 +119,21 @@ files:
|
|
117
119
|
- lib/arjdbc/jdbc/error.rb
|
118
120
|
- lib/arjdbc/jdbc/extension.rb
|
119
121
|
- lib/arjdbc/jdbc/java.rb
|
122
|
+
- lib/arjdbc/jdbc/jdbc.rake
|
120
123
|
- lib/arjdbc/jdbc/railtie.rb
|
121
124
|
- lib/arjdbc/jdbc/rake_tasks.rb
|
122
125
|
- lib/arjdbc/jdbc/serialized_attributes_helper.rb
|
123
126
|
- lib/arjdbc/jdbc/type_cast.rb
|
124
127
|
- lib/arjdbc/jdbc/type_converter.rb
|
128
|
+
- lib/arjdbc/mssql.rb
|
129
|
+
- lib/arjdbc/mssql/adapter.rb
|
130
|
+
- lib/arjdbc/mssql/column.rb
|
131
|
+
- lib/arjdbc/mssql/connection_methods.rb
|
132
|
+
- lib/arjdbc/mssql/explain_support.rb
|
133
|
+
- lib/arjdbc/mssql/limit_helpers.rb
|
134
|
+
- lib/arjdbc/mssql/lock_methods.rb
|
135
|
+
- lib/arjdbc/mssql/types.rb
|
136
|
+
- lib/arjdbc/mssql/utils.rb
|
125
137
|
- lib/arjdbc/mysql.rb
|
126
138
|
- lib/arjdbc/mysql/adapter.rb
|
127
139
|
- lib/arjdbc/mysql/connection_methods.rb
|
@@ -145,6 +157,8 @@ files:
|
|
145
157
|
- lib/arjdbc/tasks.rb
|
146
158
|
- lib/arjdbc/tasks/database_tasks.rb
|
147
159
|
- lib/arjdbc/tasks/databases.rake
|
160
|
+
- lib/arjdbc/tasks/databases3.rake
|
161
|
+
- lib/arjdbc/tasks/databases4.rake
|
148
162
|
- lib/arjdbc/tasks/db2_database_tasks.rb
|
149
163
|
- lib/arjdbc/tasks/derby_database_tasks.rb
|
150
164
|
- lib/arjdbc/tasks/h2_database_tasks.rb
|
@@ -167,6 +181,7 @@ files:
|
|
167
181
|
- rakelib/01-tomcat.rake
|
168
182
|
- rakelib/02-test.rake
|
169
183
|
- rakelib/bundler_ext.rb
|
184
|
+
- rakelib/compile.rake
|
170
185
|
- rakelib/db.rake
|
171
186
|
- rakelib/rails.rake
|
172
187
|
- src/java/arjdbc/ArJdbcModule.java
|
@@ -186,7 +201,6 @@ files:
|
|
186
201
|
- src/java/arjdbc/jdbc/DriverConnectionFactory.java
|
187
202
|
- src/java/arjdbc/jdbc/DriverWrapper.java
|
188
203
|
- src/java/arjdbc/jdbc/JdbcResult.java
|
189
|
-
- src/java/arjdbc/jdbc/RubyConnectionFactory.java
|
190
204
|
- src/java/arjdbc/jdbc/RubyJdbcConnection.java
|
191
205
|
- src/java/arjdbc/mssql/MSSQLModule.java
|
192
206
|
- src/java/arjdbc/mssql/MSSQLRubyJdbcConnection.java
|
@@ -195,7 +209,7 @@ files:
|
|
195
209
|
- src/java/arjdbc/oracle/OracleModule.java
|
196
210
|
- src/java/arjdbc/oracle/OracleRubyJdbcConnection.java
|
197
211
|
- src/java/arjdbc/postgresql/ByteaUtils.java
|
198
|
-
- src/java/arjdbc/postgresql/
|
212
|
+
- src/java/arjdbc/postgresql/PgResultSetMetaDataWrapper.java
|
199
213
|
- src/java/arjdbc/postgresql/PostgreSQLModule.java
|
200
214
|
- src/java/arjdbc/postgresql/PostgreSQLResult.java
|
201
215
|
- src/java/arjdbc/postgresql/PostgreSQLRubyJdbcConnection.java
|
@@ -211,7 +225,7 @@ homepage: https://github.com/jruby/activerecord-jdbc-adapter
|
|
211
225
|
licenses:
|
212
226
|
- BSD-2-Clause
|
213
227
|
metadata: {}
|
214
|
-
post_install_message:
|
228
|
+
post_install_message:
|
215
229
|
rdoc_options:
|
216
230
|
- "--main"
|
217
231
|
- README.md
|
@@ -231,8 +245,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
231
245
|
- !ruby/object:Gem::Version
|
232
246
|
version: '0'
|
233
247
|
requirements: []
|
234
|
-
|
235
|
-
|
248
|
+
rubyforge_project:
|
249
|
+
rubygems_version: 2.7.6
|
250
|
+
signing_key:
|
236
251
|
specification_version: 4
|
237
252
|
summary: JDBC adapter for ActiveRecord, for use within JRuby on Rails.
|
238
253
|
test_files: []
|