提交 189dc5fe authored 作者: Sergi Vladykin's avatar Sergi Vladykin

queryWithoutCacheLazyCheck

上级 c4def34a
...@@ -101,7 +101,7 @@ public abstract class Query extends Prepared { ...@@ -101,7 +101,7 @@ public abstract class Query extends Prepared {
protected abstract ResultInterface queryWithoutCache(int limit, protected abstract ResultInterface queryWithoutCache(int limit,
ResultTarget target); ResultTarget target);
protected final ResultInterface queryWithoutCache0(int limit, private ResultInterface queryWithoutCacheLazyCheck(int limit,
ResultTarget target) { ResultTarget target) {
boolean disableLazy = neverLazy && session.isLazyQueryExecution(); boolean disableLazy = neverLazy && session.isLazyQueryExecution();
if (disableLazy) { if (disableLazy) {
...@@ -337,11 +337,16 @@ public abstract class Query extends Prepared { ...@@ -337,11 +337,16 @@ public abstract class Query extends Prepared {
* @param target the target result (null will return the result) * @param target the target result (null will return the result)
* @return the result set (if the target is not set). * @return the result set (if the target is not set).
*/ */
ResultInterface query(int limit, ResultTarget target) { public final ResultInterface query(int limit, ResultTarget target) {
if (isUnion()) {
// union doesn't always know the parameter list of the left and right
// queries
return queryWithoutCacheLazyCheck(limit, target);
}
fireBeforeSelectTriggers(); fireBeforeSelectTriggers();
if (noCache || !session.getDatabase().getOptimizeReuseResults() || if (noCache || !session.getDatabase().getOptimizeReuseResults() ||
session.isLazyQueryExecution()) { session.isLazyQueryExecution()) {
return queryWithoutCache0(limit, target); return queryWithoutCacheLazyCheck(limit, target);
} }
Value[] params = getParameterValues(); Value[] params = getParameterValues();
long now = session.getDatabase().getModificationDataId(); long now = session.getDatabase().getModificationDataId();
...@@ -360,7 +365,7 @@ public abstract class Query extends Prepared { ...@@ -360,7 +365,7 @@ public abstract class Query extends Prepared {
} }
lastParameters = params; lastParameters = params;
closeLastResult(); closeLastResult();
ResultInterface r = queryWithoutCache0(limit, target); ResultInterface r = queryWithoutCacheLazyCheck(limit, target);
lastResult = r; lastResult = r;
this.lastEvaluated = now; this.lastEvaluated = now;
lastLimit = limit; lastLimit = limit;
......
...@@ -454,13 +454,6 @@ public class SelectUnion extends Query { ...@@ -454,13 +454,6 @@ public class SelectUnion extends Query {
return buff.toString(); return buff.toString();
} }
@Override
public ResultInterface query(int limit, ResultTarget target) {
// union doesn't always know the parameter list of the left and right
// queries
return queryWithoutCache0(limit, target);
}
@Override @Override
public boolean isEverything(ExpressionVisitor visitor) { public boolean isEverything(ExpressionVisitor visitor) {
return left.isEverything(visitor) && right.isEverything(visitor); return left.isEverything(visitor) && right.isEverything(visitor);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论