提交 48b45dd4 authored 作者: Sergi Vladykin's avatar Sergi Vladykin

Call Query.setNeverLazy only in Parser

上级 189dc5fe
......@@ -224,7 +224,6 @@ public class Parser {
private ArrayList<Parameter> indexedParameterList;
private int orderInFrom;
private ArrayList<Parameter> suppliedParameterList;
private boolean hasRecursive;
public Parser(Session session) {
this.database = session.getDatabase();
......@@ -301,9 +300,6 @@ public class Parser {
}
p.setPrepareAlways(recompileAlways);
p.setParameterList(parameters);
if (hasRecursive && p.isQuery() && p instanceof Query) {
((Query) p).setNeverLazy(true);
}
return p;
}
......@@ -1719,7 +1715,9 @@ public class Parser {
}
}
if (isToken("SELECT") || isToken("FROM") || isToken("(") || isToken("WITH")) {
command.setCommand(parseSelect());
Query query = parseSelect();
query.setNeverLazy(true);
command.setCommand(query);
} else if (readIf("DELETE")) {
command.setCommand(parseDelete());
} else if (readIf("UPDATE")) {
......@@ -1928,7 +1926,10 @@ public class Parser {
return command;
}
if (readIf("WITH")) {
return parseWith();
Query query = parseWith();
// recursive can not be lazy
query.setNeverLazy(true);
return query;
}
Select select = parseSelectSimple();
return select;
......@@ -2239,6 +2240,7 @@ public class Parser {
} else {
if (isSelect()) {
Query query = parseSelect();
query.setNeverLazy(true);
r = new ConditionInSelect(database, r, query, false,
Comparison.EQUAL);
} else {
......@@ -4837,7 +4839,6 @@ public class Parser {
}
private Query parseWith() {
hasRecursive = true;
readIf("RECURSIVE");
String tempViewName = readIdentifierWithSchema();
Schema schema = getSchema();
......
......@@ -38,9 +38,6 @@ public class Explain extends Prepared {
public void setCommand(Prepared command) {
this.command = command;
if (command instanceof Query) {
((Query) command).setNeverLazy(true);
}
}
public Prepared getCommand() {
......
......@@ -60,14 +60,13 @@ public abstract class Query extends Prepared {
*/
protected boolean randomAccessResult;
protected boolean neverLazy;
private boolean noCache;
private int lastLimit;
private long lastEvaluated;
private ResultInterface lastResult;
private Value[] lastParameters;
private boolean cacheableChecked;
private boolean neverLazy;
Query(Session session) {
super(session);
......@@ -77,6 +76,10 @@ public abstract class Query extends Prepared {
this.neverLazy = b;
}
public boolean isNeverLazy() {
return neverLazy;
}
/**
* Check if this is a UNION query.
*
......
......@@ -38,7 +38,6 @@ public class ConditionInSelect extends Condition {
this.query = query;
this.all = all;
this.compareType = compareType;
query.setNeverLazy(true);
}
@Override
......
......@@ -192,7 +192,7 @@ public class ViewIndex extends BaseIndex implements SpatialIndex {
parser.setRightsChecked(true);
parser.setSuppliedParameterList(originalParameters);
query = (Query) parser.prepare(querySQL);
query.setNeverLazy(true);
assert query.isNeverLazy();
}
if (!query.isUnion()) {
throw DbException.get(ErrorCode.SYNTAX_ERROR_2,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论