[#2385] fetchOne() and fetchLazy() don't terminate the ExecuteListener
life cycle when an exception occurs
This commit is contained in:
parent
5dbf025c13
commit
2b59ed047f
@ -290,8 +290,8 @@ abstract class AbstractQuery extends AbstractQueryPart implements Query, Attacha
|
||||
}
|
||||
finally {
|
||||
|
||||
// ResultQuery.fetchLazy() needs to keep open resources
|
||||
if (!keepResult()) {
|
||||
// [#2385] Successful fetchLazy() needs to keep open resources
|
||||
if (!keepResult() || ctx.exception() != null) {
|
||||
Utils.safeClose(listener, ctx, keepStatement());
|
||||
}
|
||||
|
||||
|
||||
@ -1291,8 +1291,9 @@ class CursorImpl<R extends Record> implements Cursor<R> {
|
||||
throw ctx.exception();
|
||||
}
|
||||
|
||||
// Conveniently close cursors and underlying objects after the last
|
||||
// Record was fetched
|
||||
// [#1868] [#2373] [#2385] This calls through to Utils.safeClose()
|
||||
// if necessary, lazy-terminating the ExecuteListener lifecycle if
|
||||
// the result is not eager-fetched.
|
||||
if (record == null) {
|
||||
CursorImpl.this.close();
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user