[#2385] fetchOne() and fetchLazy() don't terminate the ExecuteListener

life cycle when an exception occurs
This commit is contained in:
Lukas Eder 2013-04-12 14:14:04 +02:00
parent 5dbf025c13
commit 2b59ed047f
2 changed files with 5 additions and 4 deletions

View File

@ -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());
}

View File

@ -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();
}