提交 987e59d7 authored 作者: Sergi Vladykin's avatar Sergi Vladykin

Minor code cleanup

上级 681c8540
...@@ -102,14 +102,16 @@ public class JdbcPreparedStatement extends JdbcStatement implements ...@@ -102,14 +102,16 @@ public class JdbcPreparedStatement extends JdbcStatement implements
synchronized (session) { synchronized (session) {
checkClosed(); checkClosed();
closeOldResultSet(); closeOldResultSet();
ResultInterface result = null; ResultInterface result;
boolean lazy = false;
boolean scrollable = resultSetType != ResultSet.TYPE_FORWARD_ONLY; boolean scrollable = resultSetType != ResultSet.TYPE_FORWARD_ONLY;
boolean updatable = resultSetConcurrency == ResultSet.CONCUR_UPDATABLE; boolean updatable = resultSetConcurrency == ResultSet.CONCUR_UPDATABLE;
try { try {
setExecutingStatement(command); setExecutingStatement(command);
result = command.executeQuery(maxRows, scrollable); result = command.executeQuery(maxRows, scrollable);
lazy = result.isLazy();
} finally { } finally {
if (result == null || !result.isLazy()) { if (!lazy) {
setExecutingStatement(null); setExecutingStatement(null);
} }
} }
......
...@@ -72,18 +72,20 @@ public class JdbcStatement extends TraceObject implements Statement, JdbcStateme ...@@ -72,18 +72,20 @@ public class JdbcStatement extends TraceObject implements Statement, JdbcStateme
closeOldResultSet(); closeOldResultSet();
sql = JdbcConnection.translateSQL(sql, escapeProcessing); sql = JdbcConnection.translateSQL(sql, escapeProcessing);
CommandInterface command = conn.prepareCommand(sql, fetchSize); CommandInterface command = conn.prepareCommand(sql, fetchSize);
ResultInterface result = null; ResultInterface result;
boolean lazy = false;
boolean scrollable = resultSetType != ResultSet.TYPE_FORWARD_ONLY; boolean scrollable = resultSetType != ResultSet.TYPE_FORWARD_ONLY;
boolean updatable = resultSetConcurrency == ResultSet.CONCUR_UPDATABLE; boolean updatable = resultSetConcurrency == ResultSet.CONCUR_UPDATABLE;
setExecutingStatement(command); setExecutingStatement(command);
try { try {
result = command.executeQuery(maxRows, scrollable); result = command.executeQuery(maxRows, scrollable);
lazy = result.isLazy();
} finally { } finally {
if (result == null || !result.isLazy()) { if (!lazy) {
setExecutingStatement(null); setExecutingStatement(null);
} }
} }
if (!result.isLazy()) { if (!lazy) {
command.close(); command.close();
} }
resultSet = new JdbcResultSet(conn, this, command, result, id, resultSet = new JdbcResultSet(conn, this, command, result, id,
......
...@@ -957,11 +957,13 @@ public final class JoinBatch { ...@@ -957,11 +957,13 @@ public final class JoinBatch {
} }
viewIndex.setupQueryParameters(viewIndex.getSession(), first, last, null); viewIndex.setupQueryParameters(viewIndex.getSession(), first, last, null);
JoinBatch.this.viewTopFutureCursor = topFutureCursor; JoinBatch.this.viewTopFutureCursor = topFutureCursor;
ResultInterface localResult = null; ResultInterface localResult;
boolean lazy = false;
try { try {
localResult = viewIndex.getQuery().query(0); localResult = viewIndex.getQuery().query(0);
lazy = localResult.isLazy();
} finally { } finally {
if (localResult == null || !localResult.isLazy()) { if (!lazy) {
resetViewTopFutureCursorAfterQuery(); resetViewTopFutureCursorAfterQuery();
} }
} }
...@@ -1094,11 +1096,13 @@ public final class JoinBatch { ...@@ -1094,11 +1096,13 @@ public final class JoinBatch {
assert topFutureCursors[i] != null; assert topFutureCursors[i] != null;
joinBatches.get(i).viewTopFutureCursor = topFutureCursors[i]; joinBatches.get(i).viewTopFutureCursor = topFutureCursors[i];
} }
ResultInterface localResult = null; ResultInterface localResult;
boolean lazy = false;
try { try {
localResult = viewIndex.getQuery().query(0); localResult = viewIndex.getQuery().query(0);
lazy = localResult.isLazy();
} finally { } finally {
if (localResult == null || !localResult.isLazy()) { if (!lazy) {
resetViewTopFutureCursorAfterQuery(); resetViewTopFutureCursorAfterQuery();
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论