[#821] Optimise ResultQuery.fetchAny() executing fetchLazy() internally, and only fetching one record from the cursor
This commit is contained in:
parent
c9e458216c
commit
2585672f88
@ -214,14 +214,14 @@ abstract class AbstractResultQuery<R extends Record> extends AbstractQuery imple
|
||||
|
||||
@Override
|
||||
public final R fetchAny() throws SQLException {
|
||||
// TODO: restrict ROWNUM = 1
|
||||
Result<R> r = fetch();
|
||||
Cursor<R> c = fetchLazy();
|
||||
|
||||
if (r.size() > 0) {
|
||||
return r.get(0);
|
||||
try {
|
||||
return c.fetchOne();
|
||||
}
|
||||
finally {
|
||||
c.close();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Loading…
Reference in New Issue
Block a user