提交 5abc5fa0 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Generate subquery directly in parseMergeUsing()

上级 6c842956
...@@ -1156,11 +1156,15 @@ public class Parser { ...@@ -1156,11 +1156,15 @@ public class Parser {
TableFilter sourceTableFilter = readSimpleTableFilter(0, excludeIdentifiers); TableFilter sourceTableFilter = readSimpleTableFilter(0, excludeIdentifiers);
command.setSourceTableFilter(sourceTableFilter); command.setSourceTableFilter(sourceTableFilter);
StringBuilder buff = new StringBuilder("SELECT * FROM "); Select preparedQuery = new Select(session);
appendTableWithSchemaAndAlias(buff, sourceTableFilter.getTable(), sourceTableFilter.getTableAlias()); ArrayList<Expression> expr = new ArrayList<>(1);
Prepared preparedQuery = prepare(session, buff.toString(), null/*paramValues*/); expr.add(new Wildcard(null, null));
command.setQuery((Select) preparedQuery); preparedQuery.setExpressions(expr);
TableFilter filter = new TableFilter(session, sourceTableFilter.getTable(),
sourceTableFilter.getTableAlias(), rightsChecked, preparedQuery, 0, null);
preparedQuery.addTableFilter(filter, true);
preparedQuery.init();
command.setQuery(preparedQuery);
} }
read("ON"); read("ON");
read("("); read("(");
...@@ -4789,7 +4793,7 @@ public class Parser { ...@@ -4789,7 +4793,7 @@ public class Parser {
Select command = new Select(session); Select command = new Select(session);
currentSelect = command; currentSelect = command;
TableFilter filter = parseValuesTable(0); TableFilter filter = parseValuesTable(0);
ArrayList<Expression> list = Utils.newSmallArrayList(); ArrayList<Expression> list = new ArrayList<>(1);
list.add(new Wildcard(null, null)); list.add(new Wildcard(null, null));
command.setExpressions(list); command.setExpressions(list);
command.addTableFilter(filter, true); command.addTableFilter(filter, true);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论