提交 6c842956 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Pass Session instead of Parser to Command()

上级 d5478abd
......@@ -46,8 +46,8 @@ public abstract class Command implements CommandInterface {
private boolean canReuse;
Command(Parser parser, String sql) {
this.session = parser.getSession();
Command(Session session, String sql) {
this.session = session;
this.sql = sql;
trace = session.getDatabase().getTrace(Trace.COMMAND);
}
......
......@@ -9,6 +9,7 @@ import java.util.ArrayList;
import org.h2.api.DatabaseEventListener;
import org.h2.command.dml.Explain;
import org.h2.command.dml.Query;
import org.h2.engine.Session;
import org.h2.expression.Parameter;
import org.h2.expression.ParameterInterface;
import org.h2.result.ResultInterface;
......@@ -26,8 +27,8 @@ public class CommandContainer extends Command {
private boolean readOnlyKnown;
private boolean readOnly;
CommandContainer(Parser parser, String sql, Prepared prepared) {
super(parser, sql);
CommandContainer(Session session, String sql, Prepared prepared) {
super(session, sql);
prepared.setCommand(this);
this.prepared = prepared;
}
......
......@@ -6,6 +6,8 @@
package org.h2.command;
import java.util.ArrayList;
import org.h2.engine.Session;
import org.h2.expression.ParameterInterface;
import org.h2.result.ResultInterface;
......@@ -17,8 +19,8 @@ class CommandList extends Command {
private final Command command;
private final String remaining;
CommandList(Parser parser, String sql, Command c, String remaining) {
super(parser, sql);
CommandList(Session session, String sql, Command c, String remaining) {
super(session, sql);
this.command = c;
this.remaining = remaining;
}
......
......@@ -285,11 +285,11 @@ public class Parser {
throw getSyntaxError();
}
p.prepare();
Command c = new CommandContainer(this, sql, p);
Command c = new CommandContainer(session, sql, p);
if (hasMore) {
String remaining = originalSQL.substring(parseIndex);
if (!StringUtils.isWhitespaceOrEmpty(remaining)) {
c = new CommandList(this, sql, c, remaining);
c = new CommandList(session, sql, c, remaining);
}
}
return c;
......@@ -3877,10 +3877,6 @@ public class Parser {
currentTokenType = VALUE;
}
public Session getSession() {
return session;
}
private void initialize(String sql) {
if (sql == null) {
sql = "";
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论