activerecord-jdbc-adapter 72.0-java → 80.0.pre1-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/.github/workflows/ruby.yml +129 -24
- data/.mise.toml +3 -0
- data/Gemfile +42 -47
- data/README.md +3 -2
- data/Rakefile +62 -14
- data/activerecord-jdbc-adapter.gemspec +2 -2
- data/lib/arjdbc/abstract/core.rb +1 -1
- data/lib/arjdbc/abstract/database_statements.rb +11 -7
- data/lib/arjdbc/jdbc/adapter_java.jar +0 -0
- data/lib/arjdbc/postgresql/adapter.rb +4 -1
- data/lib/arjdbc/sqlite3/adapter.rb +48 -7
- data/lib/arjdbc/version.rb +1 -1
- data/pom.xml +3 -3
- data/rakelib/db.rake +5 -3
- data/rakelib/rails.rake +0 -1
- data/src/java/arjdbc/ArJdbcModule.java +13 -10
- data/src/java/arjdbc/db2/DB2Module.java +4 -4
- data/src/java/arjdbc/db2/DB2RubyJdbcConnection.java +8 -9
- data/src/java/arjdbc/h2/H2Module.java +2 -1
- data/src/java/arjdbc/h2/H2RubyJdbcConnection.java +8 -7
- data/src/java/arjdbc/hsqldb/HSQLDBModule.java +5 -6
- data/src/java/arjdbc/jdbc/DataSourceConnectionFactory.java +4 -3
- data/src/java/arjdbc/jdbc/DriverWrapper.java +13 -8
- data/src/java/arjdbc/jdbc/JdbcResult.java +10 -7
- data/src/java/arjdbc/jdbc/RubyJdbcConnection.java +168 -154
- data/src/java/arjdbc/mssql/MSSQLModule.java +3 -3
- data/src/java/arjdbc/mssql/MSSQLRubyJdbcConnection.java +13 -9
- data/src/java/arjdbc/mysql/MySQLModule.java +3 -3
- data/src/java/arjdbc/mysql/MySQLRubyJdbcConnection.java +30 -24
- data/src/java/arjdbc/oracle/OracleModule.java +2 -3
- data/src/java/arjdbc/oracle/OracleRubyJdbcConnection.java +22 -18
- data/src/java/arjdbc/postgresql/PostgreSQLModule.java +2 -3
- data/src/java/arjdbc/postgresql/PostgreSQLResult.java +24 -12
- data/src/java/arjdbc/postgresql/PostgreSQLRubyJdbcConnection.java +16 -12
- data/src/java/arjdbc/sqlite3/SQLite3Module.java +2 -3
- data/src/java/arjdbc/sqlite3/SQLite3RubyJdbcConnection.java +78 -29
- data/src/java/arjdbc/util/DateTimeUtils.java +7 -5
- data/src/java/arjdbc/util/ObjectSupport.java +2 -2
- data/src/java/arjdbc/util/StringHelper.java +1 -1
- metadata +6 -6
- data/.travis.yml +0 -128
|
@@ -60,6 +60,11 @@ import arjdbc.jdbc.RubyJdbcConnection;
|
|
|
60
60
|
|
|
61
61
|
import static arjdbc.util.StringHelper.newDefaultInternalString;
|
|
62
62
|
import static arjdbc.util.StringHelper.newString;
|
|
63
|
+
import static org.jruby.api.Access.getModule;
|
|
64
|
+
import static org.jruby.api.Convert.asFixnum;
|
|
65
|
+
import static org.jruby.api.Create.allocArray;
|
|
66
|
+
import static org.jruby.api.Create.newArray;
|
|
67
|
+
import static org.jruby.api.Create.newEmptyArray;
|
|
63
68
|
|
|
64
69
|
/**
|
|
65
70
|
*
|
|
@@ -77,17 +82,19 @@ public class SQLite3RubyJdbcConnection extends RubyJdbcConnection {
|
|
|
77
82
|
TIMESTAMP_FORMAT = runtime.newString("%F %T.%6N");
|
|
78
83
|
}
|
|
79
84
|
|
|
80
|
-
public static RubyClass createSQLite3JdbcConnectionClass(
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
+
public static RubyClass createSQLite3JdbcConnectionClass(ThreadContext context, RubyClass jdbcConnection) {
|
|
86
|
+
var connectionAdapters = getConnectionAdapters(context); // ActiveRecord::ConnectionAdapters
|
|
87
|
+
final RubyClass clazz = connectionAdapters.
|
|
88
|
+
defineClassUnder(context, "SQLite3JdbcConnection", jdbcConnection, ALLOCATOR).
|
|
89
|
+
defineMethods(context, SQLite3RubyJdbcConnection.class);
|
|
90
|
+
connectionAdapters.setConstant(context, "Sqlite3JdbcConnection", clazz); // backwards-compat
|
|
85
91
|
return clazz;
|
|
86
92
|
}
|
|
87
93
|
|
|
88
94
|
public static RubyClass load(final Ruby runtime) {
|
|
89
|
-
|
|
90
|
-
|
|
95
|
+
var context = runtime.getCurrentContext();
|
|
96
|
+
RubyClass jdbcConnection = getJdbcConnection(context);
|
|
97
|
+
return createSQLite3JdbcConnectionClass(context, jdbcConnection);
|
|
91
98
|
}
|
|
92
99
|
|
|
93
100
|
protected static final ObjectAllocator ALLOCATOR = new ObjectAllocator() {
|
|
@@ -140,7 +147,7 @@ public class SQLite3RubyJdbcConnection extends RubyJdbcConnection {
|
|
|
140
147
|
//return mapGeneratedKeys(context.getRuntime(), connection, statement, true);
|
|
141
148
|
// but we should assume SQLite JDBC will prefer sane API usage eventually :
|
|
142
149
|
genKeys = statement.executeQuery("SELECT last_insert_rowid()");
|
|
143
|
-
return doMapGeneratedKeys(context
|
|
150
|
+
return doMapGeneratedKeys(context, genKeys, (Boolean) true);
|
|
144
151
|
}
|
|
145
152
|
catch (final SQLException e) {
|
|
146
153
|
debugMessage(context.runtime, "failed to get generated keys: ", e);
|
|
@@ -182,8 +189,7 @@ public class SQLite3RubyJdbcConnection extends RubyJdbcConnection {
|
|
|
182
189
|
final String schemaName = schema;
|
|
183
190
|
// return super.indexes(context, tableName, name, schemaName);
|
|
184
191
|
return withConnection(context, (Callable<IRubyObject>) connection -> {
|
|
185
|
-
final
|
|
186
|
-
final RubyClass IndexDefinition = getIndexDefinition(runtime);
|
|
192
|
+
final RubyClass IndexDefinition = getIndexDefinition(context);
|
|
187
193
|
|
|
188
194
|
final TableName table1 = extractTableName(connection, null, schemaName, tableName);
|
|
189
195
|
|
|
@@ -197,11 +203,11 @@ public class SQLite3RubyJdbcConnection extends RubyJdbcConnection {
|
|
|
197
203
|
catch (SQLException e) {
|
|
198
204
|
final String msg = e.getMessage();
|
|
199
205
|
if ( msg != null && msg.startsWith("[SQLITE_ERROR] SQL error or missing database") ) {
|
|
200
|
-
return
|
|
206
|
+
return newEmptyArray(context); // on 3.8.7 getIndexInfo fails if table has no indexes
|
|
201
207
|
}
|
|
202
208
|
throw e;
|
|
203
209
|
}
|
|
204
|
-
final RubyArray indexes =
|
|
210
|
+
final RubyArray indexes = allocArray(context, 8);
|
|
205
211
|
try {
|
|
206
212
|
String currentIndex = null;
|
|
207
213
|
|
|
@@ -226,14 +232,14 @@ public class SQLite3RubyJdbcConnection extends RubyJdbcConnection {
|
|
|
226
232
|
cachedString(context, indexTableName), // table_name
|
|
227
233
|
cachedString(context, indexName), // index_name
|
|
228
234
|
nonUnique ? context.fals : context.tru, // unique
|
|
229
|
-
currentColumns =
|
|
235
|
+
currentColumns = allocArray(context, 4) // [] column names
|
|
230
236
|
};
|
|
231
237
|
|
|
232
|
-
indexes.append( IndexDefinition.newInstance(context, args, Block.NULL_BLOCK)
|
|
238
|
+
indexes.append(context, IndexDefinition.newInstance(context, args, Block.NULL_BLOCK)); // IndexDefinition.new
|
|
233
239
|
}
|
|
234
240
|
|
|
235
241
|
// one or more columns can be associated with an index
|
|
236
|
-
if ( currentColumns != null ) currentColumns.append(rubyColumnName);
|
|
242
|
+
if ( currentColumns != null ) currentColumns.append(context, rubyColumnName);
|
|
237
243
|
}
|
|
238
244
|
|
|
239
245
|
return indexes;
|
|
@@ -314,11 +320,11 @@ public class SQLite3RubyJdbcConnection extends RubyJdbcConnection {
|
|
|
314
320
|
protected RubyArray mapTables(final ThreadContext context, final Connection connection,
|
|
315
321
|
final String catalog, final String schemaPattern, final String tablePattern,
|
|
316
322
|
final ResultSet tablesSet) throws SQLException {
|
|
317
|
-
final RubyArray tables = context
|
|
323
|
+
final RubyArray tables = allocArray(context, 24);
|
|
318
324
|
while ( tablesSet.next() ) {
|
|
319
325
|
String name = tablesSet.getString(TABLES_TABLE_NAME);
|
|
320
326
|
name = name.toLowerCase(Locale.ENGLISH); // simply lower-case for SQLite3
|
|
321
|
-
tables.append( RubyString.newUnicodeString(context.runtime, name)
|
|
327
|
+
tables.append(context, RubyString.newUnicodeString(context.runtime, name));
|
|
322
328
|
}
|
|
323
329
|
return tables;
|
|
324
330
|
}
|
|
@@ -468,6 +474,50 @@ public class SQLite3RubyJdbcConnection extends RubyJdbcConnection {
|
|
|
468
474
|
// note: sqlite3 cext uses this same method but we do not combine all our statements
|
|
469
475
|
// into a single ; delimited string but leave it as an array of statements. This is
|
|
470
476
|
// because the JDBC way of handling batches is to use addBatch().
|
|
477
|
+
// Override execute to ensure Rails 8 compatibility
|
|
478
|
+
// Rails 8 SQLite3 adapter expects execute to always return something that responds to to_a
|
|
479
|
+
@Override
|
|
480
|
+
@JRubyMethod(name = "execute", required = 1)
|
|
481
|
+
public IRubyObject execute(final ThreadContext context, final IRubyObject sql) {
|
|
482
|
+
final String query = sqlString(sql);
|
|
483
|
+
return withConnection(context, connection -> {
|
|
484
|
+
Statement statement = null;
|
|
485
|
+
try {
|
|
486
|
+
statement = createStatement(context, connection);
|
|
487
|
+
|
|
488
|
+
// SQLite3 can support multiple statements in one query
|
|
489
|
+
// Process all results but return the last one for Rails compatibility
|
|
490
|
+
boolean hasResultSet = doExecute(statement, query);
|
|
491
|
+
int updateCount = statement.getUpdateCount();
|
|
492
|
+
IRubyObject result = null;
|
|
493
|
+
|
|
494
|
+
do {
|
|
495
|
+
// Query has results to process (insert/update/delete) we move on to next
|
|
496
|
+
if (hasResultSet) {
|
|
497
|
+
// For SELECT queries, return propr Result object
|
|
498
|
+
try (ResultSet rs = statement.getResultSet()) {
|
|
499
|
+
result = mapQueryResult(context, connection, rs);
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
// Check to see if there is another result set
|
|
504
|
+
hasResultSet = statement.getMoreResults();
|
|
505
|
+
updateCount = statement.getUpdateCount();
|
|
506
|
+
} while (hasResultSet || updateCount != -1);
|
|
507
|
+
|
|
508
|
+
return result == null ?
|
|
509
|
+
newEmptyResult(context) :
|
|
510
|
+
result;
|
|
511
|
+
|
|
512
|
+
} catch (final SQLException e) {
|
|
513
|
+
debugErrorSQL(context, query);
|
|
514
|
+
throw e;
|
|
515
|
+
} finally {
|
|
516
|
+
close(statement);
|
|
517
|
+
}
|
|
518
|
+
});
|
|
519
|
+
}
|
|
520
|
+
|
|
471
521
|
@JRubyMethod(name = "execute_batch2")
|
|
472
522
|
public IRubyObject execute_batch2(ThreadContext context, IRubyObject statementsArg) {
|
|
473
523
|
// Assume we will only call this with an array.
|
|
@@ -487,10 +537,10 @@ public class SQLite3RubyJdbcConnection extends RubyJdbcConnection {
|
|
|
487
537
|
|
|
488
538
|
int[] rows = statement.executeBatch();
|
|
489
539
|
|
|
490
|
-
RubyArray rowsAffected =
|
|
540
|
+
RubyArray rowsAffected = newArray(context);
|
|
491
541
|
|
|
492
542
|
for (int i = 0; i < rows.length; i++) {
|
|
493
|
-
rowsAffected.append(
|
|
543
|
+
rowsAffected.append(context, asFixnum(context, rows[i]));
|
|
494
544
|
}
|
|
495
545
|
return rowsAffected;
|
|
496
546
|
} catch (final SQLException e) {
|
|
@@ -508,21 +558,20 @@ public class SQLite3RubyJdbcConnection extends RubyJdbcConnection {
|
|
|
508
558
|
final Connection connection, final PreparedStatement statement,
|
|
509
559
|
final int index, final IRubyObject value,
|
|
510
560
|
final IRubyObject attribute, final int type) throws SQLException {
|
|
511
|
-
if (value instanceof RubyBigDecimal) {
|
|
512
|
-
statement.setString(index,
|
|
561
|
+
if (value instanceof RubyBigDecimal bigDecimal) {
|
|
562
|
+
statement.setString(index, bigDecimal.getValue().toString());
|
|
513
563
|
}
|
|
514
|
-
else if ( value instanceof RubyFixnum) {
|
|
515
|
-
statement.setLong(index,
|
|
564
|
+
else if ( value instanceof RubyFixnum fixnum) {
|
|
565
|
+
statement.setLong(index, fixnum.getValue());
|
|
516
566
|
}
|
|
517
|
-
else if ( value instanceof RubyInteger) { // Bignum
|
|
518
|
-
statement.setString(index,
|
|
567
|
+
else if ( value instanceof RubyInteger integer) { // Bignum
|
|
568
|
+
statement.setString(index, integer.asBigInteger(context).toString());
|
|
519
569
|
}
|
|
520
|
-
else if ( value instanceof RubyNumeric ) {
|
|
521
|
-
statement.setDouble(index,
|
|
570
|
+
else if ( value instanceof RubyNumeric numeric) {
|
|
571
|
+
statement.setDouble(index, numeric.asDouble(context));
|
|
522
572
|
}
|
|
523
573
|
else { // e.g. `BigDecimal '42.00000000000000000001'`
|
|
524
|
-
|
|
525
|
-
RubyBigDecimal val = RubyBigDecimal.newInstance(context, runtime.getModule("BigDecimal"), value, RubyFixnum.zero(runtime));
|
|
574
|
+
RubyBigDecimal val = RubyBigDecimal.newInstance(context, getModule(context, "BigDecimal"), value, asFixnum(context, 0));
|
|
526
575
|
statement.setString(index, val.getValue().toString());
|
|
527
576
|
}
|
|
528
577
|
}
|
|
@@ -46,6 +46,7 @@ import org.jruby.util.ByteList;
|
|
|
46
46
|
import org.jruby.util.TypeConverter;
|
|
47
47
|
|
|
48
48
|
import static arjdbc.util.StringHelper.decByte;
|
|
49
|
+
import static org.jruby.api.Access.objectClass;
|
|
49
50
|
|
|
50
51
|
/**
|
|
51
52
|
* Utilities for handling/converting dates and times.
|
|
@@ -279,12 +280,13 @@ public abstract class DateTimeUtils {
|
|
|
279
280
|
|
|
280
281
|
// @Deprecated
|
|
281
282
|
public static Timestamp convertToTimestamp(final RubyFloat value) {
|
|
282
|
-
|
|
283
|
+
var context = value.getRuntime().getCurrentContext();
|
|
284
|
+
final Timestamp timestamp = new Timestamp(value.asLong(context) * 1000); // millis
|
|
283
285
|
|
|
284
286
|
// for usec we shall not use: ((long) floatValue * 1000000) % 1000
|
|
285
287
|
// if ( usec >= 0 ) timestamp.setNanos( timestamp.getNanos() + usec * 1000 );
|
|
286
288
|
// due doubles inaccurate precision it's better to parse to_s :
|
|
287
|
-
final ByteList strValue = ((RubyString) value.to_s()).getByteList();
|
|
289
|
+
final ByteList strValue = ((RubyString) value.to_s(context)).getByteList();
|
|
288
290
|
final int dot1 = strValue.lastIndexOf('.') + 1, dot4 = dot1 + 3;
|
|
289
291
|
final int len = strValue.getRealSize() - strValue.getBegin();
|
|
290
292
|
if ( dot1 > 0 && dot4 < len ) { // skip .123 but handle .1234
|
|
@@ -307,7 +309,7 @@ public abstract class DateTimeUtils {
|
|
|
307
309
|
|
|
308
310
|
public static double adjustTimeFromDefaultZone(final IRubyObject value) {
|
|
309
311
|
// Time's to_f is : ( millis * 1000 + usec ) / 1_000_000.0
|
|
310
|
-
final double time = value.convertToFloat().
|
|
312
|
+
final double time = value.convertToFloat().getValue(); // to_f
|
|
311
313
|
// NOTE: MySQL assumes default TZ thus need to adjust to match :
|
|
312
314
|
final int offset = TimeZone.getDefault().getOffset((long) time * 1000);
|
|
313
315
|
// Time's to_f is : ( millis * 1000 + usec ) / 1_000_000.0
|
|
@@ -584,8 +586,8 @@ public abstract class DateTimeUtils {
|
|
|
584
586
|
|
|
585
587
|
DateTime dateTime = new DateTime(year, month, day, 0, 0, 0, 0, chronology);
|
|
586
588
|
|
|
587
|
-
|
|
588
|
-
|
|
589
|
+
return objectClass(context).getClass(context, "Date").
|
|
590
|
+
newInstance(context, Java.getInstance(context.runtime, dateTime), Block.NULL_BLOCK);
|
|
589
591
|
}
|
|
590
592
|
|
|
591
593
|
@SuppressWarnings("deprecation")
|
|
@@ -23,8 +23,9 @@ public abstract class ObjectSupport {
|
|
|
23
23
|
|
|
24
24
|
private static StringBuilder inspect(final Ruby runtime, final RubyBasicObject self,
|
|
25
25
|
final List<Variable> variableList) {
|
|
26
|
+
var context = runtime.getCurrentContext();
|
|
26
27
|
final StringBuilder part = new StringBuilder();
|
|
27
|
-
String cname = self.getMetaClass().getRealClass().getName();
|
|
28
|
+
String cname = self.getMetaClass().getRealClass().getName(context);
|
|
28
29
|
part.append("#<").append(cname).append(":0x");
|
|
29
30
|
part.append(Integer.toHexString(System.identityHashCode(self)));
|
|
30
31
|
|
|
@@ -35,7 +36,6 @@ public abstract class ObjectSupport {
|
|
|
35
36
|
}
|
|
36
37
|
try {
|
|
37
38
|
runtime.registerInspecting(self);
|
|
38
|
-
final ThreadContext context = runtime.getCurrentContext();
|
|
39
39
|
return inspectObj(context, variableList, part);
|
|
40
40
|
} finally {
|
|
41
41
|
runtime.unregisterInspecting(self);
|
|
@@ -68,7 +68,7 @@ public abstract class StringHelper {
|
|
|
68
68
|
public static RubyString newDefaultInternalString(final Ruby runtime, final CharSequence str) {
|
|
69
69
|
Encoding enc = runtime.getDefaultInternalEncoding();
|
|
70
70
|
if (enc == null) enc = runtime.getEncodingService().getJavaDefault();
|
|
71
|
-
return
|
|
71
|
+
return RubyString.newString(runtime, str, enc);
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
// NOTE: a 'better' RubyString.newInternalFromJavaExternal - to be back-ported in JRuby 9.2
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: activerecord-jdbc-adapter
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 80.0.pre1
|
|
5
5
|
platform: java
|
|
6
6
|
authors:
|
|
7
7
|
- Nick Sieger, Ola Bini, Karol Bucek and JRuby contributors
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: activerecord
|
|
@@ -15,14 +15,14 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - "~>"
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version:
|
|
18
|
+
version: 8.0.0
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - "~>"
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version:
|
|
25
|
+
version: 8.0.0
|
|
26
26
|
description: 'AR-JDBC is a database adapter for Rails'' ActiveRecord component designed
|
|
27
27
|
to be used with JRuby built upon Java''s JDBC API for database access. Provides
|
|
28
28
|
(ActiveRecord) built-in adapters: MySQL, PostgreSQL, and SQLite3.'
|
|
@@ -36,7 +36,7 @@ extra_rdoc_files: []
|
|
|
36
36
|
files:
|
|
37
37
|
- ".github/workflows/ruby.yml"
|
|
38
38
|
- ".gitignore"
|
|
39
|
-
- ".
|
|
39
|
+
- ".mise.toml"
|
|
40
40
|
- ".yardopts"
|
|
41
41
|
- CONTRIBUTING.md
|
|
42
42
|
- Gemfile
|
|
@@ -203,7 +203,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
203
203
|
- !ruby/object:Gem::Version
|
|
204
204
|
version: '0'
|
|
205
205
|
requirements: []
|
|
206
|
-
rubygems_version:
|
|
206
|
+
rubygems_version: 4.0.3
|
|
207
207
|
specification_version: 4
|
|
208
208
|
summary: JDBC adapter for ActiveRecord, for use within JRuby on Rails.
|
|
209
209
|
test_files: []
|
data/.travis.yml
DELETED
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
sudo: false
|
|
2
|
-
dist: xenial
|
|
3
|
-
|
|
4
|
-
services:
|
|
5
|
-
- mysql
|
|
6
|
-
|
|
7
|
-
before_install:
|
|
8
|
-
- unset _JAVA_OPTIONS
|
|
9
|
-
- rvm @default,@global do gem uninstall bundler -a -x -I || true
|
|
10
|
-
- gem install bundler -v "~>1.17.3"
|
|
11
|
-
install:
|
|
12
|
-
- bundle install --retry 3 --without development
|
|
13
|
-
# to fix this issue: https://travis-ci.community/t/mariadb-10-1-fails-to-install-on-xenial/3151/3
|
|
14
|
-
- mysql -u root -e 'CREATE USER IF NOT EXISTS travis@localhost; GRANT ALL ON *.* TO travis@localhost;' || true
|
|
15
|
-
|
|
16
|
-
language: ruby
|
|
17
|
-
rvm:
|
|
18
|
-
- jruby-9.2.14.0
|
|
19
|
-
jdk:
|
|
20
|
-
- openjdk8
|
|
21
|
-
|
|
22
|
-
script: bundle exec rake ${TEST_PREFIX}test_$DB
|
|
23
|
-
before_script:
|
|
24
|
-
- echo "JAVA_OPTS=$JAVA_OPTS"
|
|
25
|
-
- export JRUBY_OPTS="-J-Xms64M -J-Xmx1024M"
|
|
26
|
-
- rake jar # compiles ext generates: lib/arjdbc/jdbc/adapter_java.jar
|
|
27
|
-
- mysql --version || true # to see if we're using MySQL or MariaDB
|
|
28
|
-
- '[ "$DB" == "postgresql" ] && [ "$TEST_PREFIX" == "" ] && rake db:postgresql || true'
|
|
29
|
-
- '[ "$DB" == "mysql2" ] && [ "$TEST_PREFIX" == "" ] && rake db:mysql || true'
|
|
30
|
-
- '[ "$DB" == "mariadb" ] && [ "$TEST_PREFIX" == "" ] && rake db:mysql || true'
|
|
31
|
-
- '[ "$DB" == "jdbc" ] && rake db:mysql || true'
|
|
32
|
-
- '[ "$DB" == "jndi" ] && rake db:mysql || true'
|
|
33
|
-
# rails:test setups :
|
|
34
|
-
- |
|
|
35
|
-
[ "$DB" == "mysql2" ] && [ "$TEST_PREFIX" == "rails:" ] && \
|
|
36
|
-
mysql -e "CREATE USER rails@localhost;" && \
|
|
37
|
-
mysql -e "grant all privileges on activerecord_unittest.* to rails@localhost;" && \
|
|
38
|
-
mysql -e "grant all privileges on activerecord_unittest2.* to rails@localhost;" && \
|
|
39
|
-
mysql -e "grant all privileges on inexistent_activerecord_unittest.* to rails@localhost;" && \
|
|
40
|
-
mysql -e "CREATE DATABASE activerecord_unittest DEFAULT CHARACTER SET utf8mb4;" && \
|
|
41
|
-
mysql -e "CREATE DATABASE activerecord_unittest2 DEFAULT CHARACTER SET utf8mb4;" \
|
|
42
|
-
|| true
|
|
43
|
-
- |
|
|
44
|
-
[ "$DB" == "postgresql" ] && [ "$TEST_PREFIX" == "rails:" ] && \
|
|
45
|
-
psql -c "create database activerecord_unittest;" -U postgres && \
|
|
46
|
-
psql -c "create database activerecord_unittest2;" -U postgres \
|
|
47
|
-
|| true
|
|
48
|
-
|
|
49
|
-
env:
|
|
50
|
-
global:
|
|
51
|
-
- AR_VERSION="master"
|
|
52
|
-
matrix:
|
|
53
|
-
allow_failures:
|
|
54
|
-
- rvm: jruby-head
|
|
55
|
-
include:
|
|
56
|
-
- env: DB=mysql2 PREPARED_STATEMENTS=false
|
|
57
|
-
- env: DB=mysql2 PREPARED_STATEMENTS=true
|
|
58
|
-
- env: DB=mysql2 DRIVER=MariaDB
|
|
59
|
-
|
|
60
|
-
- addons:
|
|
61
|
-
postgresql: "10"
|
|
62
|
-
env: DB=postgresql PREPARED_STATEMENTS=false INSERT_RETURNING=false
|
|
63
|
-
- addons:
|
|
64
|
-
postgresql: "10"
|
|
65
|
-
env: DB=postgresql PREPARED_STATEMENTS=false INSERT_RETURNING=true
|
|
66
|
-
- addons:
|
|
67
|
-
postgresql: "10"
|
|
68
|
-
env: DB=postgresql PREPARED_STATEMENTS=true
|
|
69
|
-
- addons:
|
|
70
|
-
postgresql: "10"
|
|
71
|
-
env: DB=postgresql PREPARED_STATEMENTS=true INSERT_RETURNING=true
|
|
72
|
-
- addons:
|
|
73
|
-
postgresql: "10"
|
|
74
|
-
env: DB=postgresql PREPARED_STATEMENTS=true JRUBY_OPTS=-J-Duser.timezone=America/Detroit
|
|
75
|
-
- addons:
|
|
76
|
-
postgresql: "9.4"
|
|
77
|
-
env: DB=postgresql PREPARED_STATEMENTS=true
|
|
78
|
-
|
|
79
|
-
- env: DB=sqlite3 PREPARED_STATEMENTS=false
|
|
80
|
-
- env: DB=sqlite3 PREPARED_STATEMENTS=true
|
|
81
|
-
|
|
82
|
-
- env: DB=jndi PREPARED_STATEMENTS=false
|
|
83
|
-
- env: DB=jndi PREPARED_STATEMENTS=true
|
|
84
|
-
|
|
85
|
-
# Java 11
|
|
86
|
-
- env: DB=mysql2
|
|
87
|
-
jdk: oraclejdk11
|
|
88
|
-
- env: DB=postgresql
|
|
89
|
-
jdk: oraclejdk11
|
|
90
|
-
addons:
|
|
91
|
-
postgresql: "10"
|
|
92
|
-
- env: DB=sqlite3
|
|
93
|
-
jdk: oraclejdk11
|
|
94
|
-
|
|
95
|
-
# jruby-head
|
|
96
|
-
- rvm: jruby-head
|
|
97
|
-
env: DB=mysql2
|
|
98
|
-
- rvm: jruby-head
|
|
99
|
-
env: DB=postgresql
|
|
100
|
-
addons:
|
|
101
|
-
postgresql: "10"
|
|
102
|
-
- rvm: jruby-head
|
|
103
|
-
env: DB=sqlite3
|
|
104
|
-
|
|
105
|
-
# testing against MariaDB
|
|
106
|
-
- addons:
|
|
107
|
-
mariadb: 10.2
|
|
108
|
-
env: DB=mariadb PREPARED_STATEMENTS=false
|
|
109
|
-
- addons:
|
|
110
|
-
mariadb: 10.3
|
|
111
|
-
env: DB=mariadb PREPARED_STATEMENTS=true
|
|
112
|
-
|
|
113
|
-
# Rails test-suite :
|
|
114
|
-
- env: DB=mysql2 TEST_PREFIX="rails:" AR_VERSION="6-1-stable" # PS off by default
|
|
115
|
-
- env: DB=mysql2 TEST_PREFIX="rails:" AR_VERSION="6-1-stable" PREPARED_STATEMENTS=true
|
|
116
|
-
- env: DB=mysql2 TEST_PREFIX="rails:" AR_VERSION="6-1-stable" DRIVER=MariaDB
|
|
117
|
-
|
|
118
|
-
- addons:
|
|
119
|
-
postgresql: "10"
|
|
120
|
-
env: DB=postgresql TEST_PREFIX="rails:" AR_VERSION="6-1-stable" # PS on by default
|
|
121
|
-
- addons:
|
|
122
|
-
postgresql: "10"
|
|
123
|
-
env: DB=postgresql TEST_PREFIX="rails:" AR_VERSION="6-1-stable" PREPARED_STATEMENTS=false
|
|
124
|
-
- addons:
|
|
125
|
-
postgresql: "9.4"
|
|
126
|
-
env: DB=postgresql TEST_PREFIX="rails:" AR_VERSION="6-1-stable" # PS on by default
|
|
127
|
-
|
|
128
|
-
- env: DB=sqlite3 TEST_PREFIX="rails:" AR_VERSION="6-1-stable"
|