Skip to content

Commit 01cbc91

Browse files
committed
Merge branch 'master' into feat/2618-auto-determine-type-when-missing
2 parents 6b12edc + b7f81e1 commit 01cbc91

File tree

15 files changed

+509
-51
lines changed

15 files changed

+509
-51
lines changed

pom.xml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106
<dependency>
107107
<groupId>ognl</groupId>
108108
<artifactId>ognl</artifactId>
109-
<version>3.4.4</version>
109+
<version>3.4.5</version>
110110
<scope>compile</scope>
111111
<optional>true</optional>
112112
</dependency>
@@ -204,6 +204,12 @@
204204
<version>9.1.0</version>
205205
<scope>test</scope>
206206
</dependency>
207+
<dependency>
208+
<groupId>com.oracle.database.jdbc</groupId>
209+
<artifactId>ojdbc8</artifactId>
210+
<version>23.6.0.24.10</version>
211+
<scope>test</scope>
212+
</dependency>
207213
<dependency>
208214
<groupId>org.assertj</groupId>
209215
<artifactId>assertj-core</artifactId>
@@ -254,6 +260,12 @@
254260
<version>${testcontainers.version}</version>
255261
<scope>test</scope>
256262
</dependency>
263+
<dependency>
264+
<groupId>org.testcontainers</groupId>
265+
<artifactId>oracle-free</artifactId>
266+
<version>${testcontainers.version}</version>
267+
<scope>test</scope>
268+
</dependency>
257269
<!-- For javadoc link -->
258270
<dependency>
259271
<groupId>com.microsoft.sqlserver</groupId>
@@ -292,7 +304,7 @@
292304
<dependency>
293305
<groupId>ch.qos.logback</groupId>
294306
<artifactId>logback-classic</artifactId>
295-
<version>1.5.15</version>
307+
<version>1.5.16</version>
296308
<scope>test</scope>
297309
</dependency>
298310
<dependency>

src/main/java/org/apache/ibatis/executor/resultset/DefaultResultSetHandler.java

Lines changed: 35 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -247,34 +247,49 @@ public <E> Cursor<E> handleCursorResultSets(Statement stmt) throws SQLException
247247
}
248248

249249
private ResultSetWrapper getFirstResultSet(Statement stmt) throws SQLException {
250-
ResultSet rs = stmt.getResultSet();
251-
while (rs == null) {
252-
// move forward to get the first resultset in case the driver
253-
// doesn't return the resultset as the first result (HSQLDB)
254-
if (stmt.getMoreResults()) {
255-
rs = stmt.getResultSet();
256-
} else if (stmt.getUpdateCount() == -1) {
257-
// no more results. Must be no resultset
258-
break;
250+
ResultSet rs = null;
251+
SQLException e1 = null;
252+
253+
try {
254+
rs = stmt.getResultSet();
255+
} catch (SQLException e) {
256+
// Oracle throws ORA-17283 for implicit cursor
257+
e1 = e;
258+
}
259+
260+
try {
261+
while (rs == null) {
262+
// move forward to get the first resultset in case the driver
263+
// doesn't return the resultset as the first result (HSQLDB)
264+
if (stmt.getMoreResults()) {
265+
rs = stmt.getResultSet();
266+
} else if (stmt.getUpdateCount() == -1) {
267+
// no more results. Must be no resultset
268+
break;
269+
}
259270
}
271+
} catch (SQLException e) {
272+
throw e1 != null ? e1 : e;
260273
}
274+
261275
return rs != null ? new ResultSetWrapper(rs, configuration) : null;
262276
}
263277

264278
private ResultSetWrapper getNextResultSet(Statement stmt) {
265279
// Making this method tolerant of bad JDBC drivers
266280
try {
267-
if (stmt.getConnection().getMetaData().supportsMultipleResultSets()) {
268-
// Crazy Standard JDBC way of determining if there are more results
269-
// DO NOT try to 'improve' the condition even if IDE tells you to!
270-
// It's important that getUpdateCount() is called here.
271-
if (!(!stmt.getMoreResults() && stmt.getUpdateCount() == -1)) {
272-
ResultSet rs = stmt.getResultSet();
273-
if (rs == null) {
274-
return getNextResultSet(stmt);
275-
} else {
276-
return new ResultSetWrapper(rs, configuration);
277-
}
281+
// We stopped checking DatabaseMetaData#supportsMultipleResultSets()
282+
// because Oracle driver (incorrectly) returns false
283+
284+
// Crazy Standard JDBC way of determining if there are more results
285+
// DO NOT try to 'improve' the condition even if IDE tells you to!
286+
// It's important that getUpdateCount() is called here.
287+
if (!(!stmt.getMoreResults() && stmt.getUpdateCount() == -1)) {
288+
ResultSet rs = stmt.getResultSet();
289+
if (rs == null) {
290+
return getNextResultSet(stmt);
291+
} else {
292+
return new ResultSetWrapper(rs, configuration);
278293
}
279294
}
280295
} catch (Exception e) {

src/site/es/xdoc/configuration.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
4-
Copyright 2009-2024 the original author or authors.
4+
Copyright 2009-2025 the original author or authors.
55
66
Licensed under the Apache License, Version 2.0 (the "License");
77
you may not use this file except in compliance with the License.
@@ -220,7 +220,7 @@ SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(reader, environ
220220
true | false
221221
</td>
222222
<td>
223-
False
223+
false
224224
</td>
225225
</tr>
226226
<tr>
@@ -323,7 +323,7 @@ SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(reader, environ
323323
true | false
324324
</td>
325325
<td>
326-
False
326+
false
327327
</td>
328328
</tr>
329329
<tr>
@@ -338,7 +338,7 @@ SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(reader, environ
338338
true | false
339339
</td>
340340
<td>
341-
True
341+
true
342342
</td>
343343
</tr>
344344
<tr>
@@ -351,7 +351,7 @@ SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(reader, environ
351351
true | false
352352
</td>
353353
<td>
354-
False
354+
false
355355
</td>
356356
</tr>
357357
<tr>

src/site/ja/xdoc/configuration.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
4-
Copyright 2009-2024 the original author or authors.
4+
Copyright 2009-2025 the original author or authors.
55
66
Licensed under the Apache License, Version 2.0 (the "License");
77
you may not use this file except in compliance with the License.
@@ -240,7 +240,7 @@ SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(reader, environ
240240
true | false
241241
</td>
242242
<td>
243-
False
243+
false
244244
</td>
245245
</tr>
246246
<tr>
@@ -354,7 +354,7 @@ SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(reader, environ
354354
true | false
355355
</td>
356356
<td>
357-
False
357+
false
358358
</td>
359359
</tr>
360360
<tr>
@@ -369,7 +369,7 @@ SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(reader, environ
369369
true | false
370370
</td>
371371
<td>
372-
True
372+
true
373373
</td>
374374
</tr>
375375
<tr>
@@ -383,7 +383,7 @@ SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(reader, environ
383383
true | false
384384
</td>
385385
<td>
386-
False
386+
false
387387
</td>
388388
</tr>
389389
<tr>

src/site/ko/xdoc/configuration.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
4-
Copyright 2009-2024 the original author or authors.
4+
Copyright 2009-2025 the original author or authors.
55
66
Licensed under the Apache License, Version 2.0 (the "License");
77
you may not use this file except in compliance with the License.
@@ -214,7 +214,7 @@ SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(reader, environ
214214
true | false
215215
</td>
216216
<td>
217-
False
217+
false
218218
</td>
219219
</tr>
220220
<tr>
@@ -334,7 +334,7 @@ SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(reader, environ
334334
true | false
335335
</td>
336336
<td>
337-
False
337+
false
338338
</td>
339339
</tr>
340340
<tr>
@@ -349,7 +349,7 @@ SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(reader, environ
349349
true | false
350350
</td>
351351
<td>
352-
True
352+
true
353353
</td>
354354
</tr>
355355
<tr>
@@ -363,7 +363,7 @@ SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(reader, environ
363363
true | false
364364
</td>
365365
<td>
366-
False
366+
false
367367
</td>
368368
</tr>
369369
<tr>

0 commit comments

Comments
 (0)