Skip to content

Commit 40f6558

Browse files
committed
Updated with 52-stable
2 parents 62e3d66 + 54750df commit 40f6558

20 files changed

+61
-39
lines changed

.travis.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -61,20 +61,20 @@ matrix:
6161
- rvm: jruby-head
6262
include:
6363
# jruby-9.2
64-
- rvm: jruby-9.2.4.0
64+
- rvm: jruby-9.2.5.0
6565
env: DB=mysql2
66-
- rvm: jruby-9.2.4.0
66+
- rvm: jruby-9.2.5.0
6767
env: DB=postgresql
68-
- rvm: jruby-9.2.4.0
68+
- rvm: jruby-9.2.5.0
6969
env: DB=sqlite3
7070
# jruby-9.2 + Java 11
71-
- rvm: jruby-9.2.4.0
71+
- rvm: jruby-9.2.5.0
7272
env: DB=mysql2
7373
jdk: openjdk11
74-
- rvm: jruby-9.2.4.0
74+
- rvm: jruby-9.2.5.0
7575
env: DB=postgresql
7676
jdk: openjdk11
77-
- rvm: jruby-9.2.4.0
77+
- rvm: jruby-9.2.5.0
7878
env: DB=sqlite3
7979
jdk: openjdk11
8080
# jruby-head
@@ -92,9 +92,9 @@ matrix:
9292
mariadb: '10.1'
9393
env: DB=mariadb PREPARED_STATEMENTS=true
9494
# Rails test-suite :
95-
- env: DB=mysql2 TEST_PREFIX="rails:" AR_VERSION="v5.2.0" # PS off by default
96-
- env: DB=mysql2 TEST_PREFIX="rails:" AR_VERSION="v5.2.0" PREPARED_STATEMENTS=true
97-
- env: DB=mysql2 TEST_PREFIX="rails:" AR_VERSION="v5.2.0" DRIVER=MariaDB
98-
- env: DB=postgresql TEST_PREFIX="rails:" AR_VERSION="v5.2.0" # PS on by default
99-
- env: DB=postgresql TEST_PREFIX="rails:" AR_VERSION="v5.2.0" PREPARED_STATEMENTS=false
100-
- env: DB=sqlite3 TEST_PREFIX="rails:" AR_VERSION="v5.2.0"
95+
- env: DB=mysql2 TEST_PREFIX="rails:" AR_VERSION="v5.2.2" # PS off by default
96+
- env: DB=mysql2 TEST_PREFIX="rails:" AR_VERSION="v5.2.2" PREPARED_STATEMENTS=true
97+
- env: DB=mysql2 TEST_PREFIX="rails:" AR_VERSION="v5.2.2" DRIVER=MariaDB
98+
- env: DB=postgresql TEST_PREFIX="rails:" AR_VERSION="v5.2.2" # PS on by default
99+
- env: DB=postgresql TEST_PREFIX="rails:" AR_VERSION="v5.2.2" PREPARED_STATEMENTS=false
100+
- env: DB=sqlite3 TEST_PREFIX="rails:" AR_VERSION="v5.2.2"

lib/arjdbc/db2/adapter.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,6 @@ def pk_and_sequence_for(table)
404404
# @override
405405
def quote(value)
406406
return value if sql_literal?(value)
407-
408407
super
409408
end
410409

lib/arjdbc/postgresql/adapter.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -690,6 +690,10 @@ def local_tz
690690
@local_tz ||= execute('SHOW TIME ZONE', 'SCHEMA').first["TimeZone"]
691691
end
692692

693+
def bind_params_length
694+
32767
695+
end
696+
693697
end
694698
end
695699

src/java/arjdbc/ArJdbcModule.java

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import java.util.Map;
3030
import java.util.WeakHashMap;
3131

32-
import org.jruby.NativeException;
3332
import org.jruby.Ruby;
3433
import org.jruby.RubyArray;
3534
import org.jruby.RubyClass;
@@ -148,13 +147,7 @@ public static IRubyObject load_java_part(final ThreadContext context,
148147
}
149148
}
150149
catch (ClassNotFoundException e) { /* ignored */ }
151-
catch (NoSuchMethodException e) {
152-
throw newNativeException(runtime, e);
153-
}
154-
catch (IllegalAccessException e) {
155-
throw newNativeException(runtime, e);
156-
}
157-
catch (InvocationTargetException e) {
150+
catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
158151
throw newNativeException(runtime, e);
159152
}
160153

@@ -263,18 +256,15 @@ private static Object invokeStatic(final Ruby runtime,
263256
try {
264257
return klass.getMethod(name, argType).invoke(null, arg);
265258
}
266-
catch (IllegalAccessException e) {
267-
throw newNativeException(runtime, e);
268-
}
269-
catch (InvocationTargetException e) {
259+
catch (IllegalAccessException | InvocationTargetException e) {
270260
throw newNativeException(runtime, e);
271261
}
272262
}
273263

274264
private static RaiseException newNativeException(final Ruby runtime, final Throwable cause) {
275-
RubyClass nativeClass = runtime.getClass(NativeException.CLASS_NAME);
276-
NativeException nativeException = new NativeException(runtime, nativeClass, cause);
277-
return new RaiseException(cause, nativeException);
265+
final RaiseException error = runtime.newRuntimeError(cause.toString());
266+
error.initCause(cause);
267+
return error;
278268
}
279269

280270
@JRubyMethod(meta = true)

src/java/arjdbc/derby/DerbyRubyJdbcConnection.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ protected DriverWrapper newDriverWrapper(final ThreadContext context, final Stri
8383
final int minor = jdbcDriver.getMinorVersion();
8484
if ( major < 10 || ( major == 10 && minor < 5 ) ) {
8585
final RubyClass errorClass = getConnectionNotEstablished(context.runtime);
86-
throw new RaiseException(context.runtime, errorClass,
87-
"adapter requires Derby >= 10.5 got: " + major + "." + minor + "", false);
86+
throw context.runtime.newRaiseException(errorClass,
87+
"adapter requires Derby >= 10.5 got: " + major + "." + minor + "");
8888
}
8989
if ( major == 10 && minor < 8 ) { // 10.8 ~ supports JDBC 4.1
9090
// config[:connection_alive_sql] ||= 'SELECT 1 FROM SYS.SYSSCHEMAS FETCH FIRST 1 ROWS ONLY'

src/java/arjdbc/jdbc/RubyJdbcConnection.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1807,7 +1807,7 @@ private ConnectionFactory setDriverFactory(final ThreadContext context) {
18071807
if ( url.isNil() || ( driver.isNil() && driver_instance.isNil() ) ) {
18081808
final Ruby runtime = context.runtime;
18091809
final RubyClass errorClass = getConnectionNotEstablished( runtime );
1810-
throw new RaiseException(runtime, errorClass, "adapter requires :driver class and jdbc :url", false);
1810+
throw runtime.newRaiseException(errorClass, "adapter requires :driver class and jdbc :url");
18111811
}
18121812

18131813
final String jdbcURL = buildURL(context, url);
@@ -3008,7 +3008,7 @@ private Connection getConnectionInternal(final boolean required) throws SQLExcep
30083008
private void handleNotConnected() {
30093009
final Ruby runtime = getRuntime();
30103010
final RubyClass errorClass = getConnectionNotEstablished( runtime );
3011-
throw new RaiseException(runtime, errorClass, "no connection available", false);
3011+
throw runtime.newRaiseException(errorClass, "no connection available");
30123012
}
30133013

30143014
/**
@@ -3545,7 +3545,7 @@ protected RaiseException wrapException(final ThreadContext context, final Throwa
35453545
return (RaiseException) exception;
35463546
}
35473547
if ( exception instanceof RuntimeException ) {
3548-
return RaiseException.createNativeRaiseException(runtime, exception);
3548+
return wrapException(context, context.runtime.getRuntimeError(), exception);
35493549
}
35503550
// NOTE: compat - maybe makes sense or maybe not (e.g. IOException) :
35513551
return wrapException(context, getJDBCError(runtime), exception);
@@ -3558,7 +3558,7 @@ public static RaiseException wrapException(final ThreadContext context,
35583558

35593559
public static RaiseException wrapException(final ThreadContext context,
35603560
final RubyClass errorClass, final Throwable exception, final String message) {
3561-
final RaiseException error = new RaiseException(context.runtime, errorClass, message, true);
3561+
final RaiseException error = context.runtime.newRaiseException(errorClass, message);
35623562
error.initCause(exception);
35633563
return error;
35643564
}

src/java/arjdbc/mysql/MySQLRubyJdbcConnection.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ protected DriverWrapper newDriverWrapper(final ThreadContext context, final Stri
107107
final int minor = jdbcDriver.getMinorVersion();
108108
if ( major < 5 ) {
109109
final RubyClass errorClass = getConnectionNotEstablished(context.runtime);
110-
throw new RaiseException(context.runtime, errorClass,
111-
"MySQL adapter requires driver >= 5.0 got: " + major + "." + minor + "", false);
110+
throw context.runtime.newRaiseException(errorClass,
111+
"MySQL adapter requires driver >= 5.0 got: " + major + "." + minor + "");
112112
}
113113
if ( major == 5 && minor < 1 ) { // need 5.1 for JDBC 4.0
114114
// lightweight validation query: "/* ping */ SELECT 1"

test/bind_params_length_test.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
require 'test_helper'
2+
require 'models/topic'
3+
4+
class BindParamsLengthTest < Test::Unit::TestCase
5+
def setup
6+
TopicMigration.up
7+
Topic.create!(title: 'blub')
8+
end
9+
10+
def teardown
11+
TopicMigration.down
12+
end
13+
14+
def test_bind_param_length
15+
assert Topic.where(id: [1] * 35000).first
16+
end
17+
end
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
require 'db/mysql'
2+
require 'bind_params_length_test'
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
require 'db/postgres'
2+
require 'bind_params_length_test'

0 commit comments

Comments
 (0)