提交 b08ba47c authored 作者: Thomas Mueller's avatar Thomas Mueller

respect schema name in wildcards

上级 dbc23ef3
...@@ -555,6 +555,7 @@ public class Select extends Query { ...@@ -555,6 +555,7 @@ public class Select extends Query {
if (!expr.isWildcard()) { if (!expr.isWildcard()) {
continue; continue;
} }
String schemaName = expr.getSchemaName();
String tableAlias = expr.getTableAlias(); String tableAlias = expr.getTableAlias();
if (tableAlias == null) { if (tableAlias == null) {
int temp = i; int temp = i;
...@@ -570,10 +571,12 @@ public class Select extends Query { ...@@ -570,10 +571,12 @@ public class Select extends Query {
for (int j = 0; j < filters.size(); j++) { for (int j = 0; j < filters.size(); j++) {
TableFilter f = (TableFilter) filters.get(j); TableFilter f = (TableFilter) filters.get(j);
if (tableAlias.equals(f.getTableAlias())) { if (tableAlias.equals(f.getTableAlias())) {
if (schemaName == null || schemaName.equals(f.getSchemaName())) {
filter = f; filter = f;
break; break;
} }
} }
}
if (filter == null) { if (filter == null) {
throw Message.getSQLException(ErrorCode.TABLE_OR_VIEW_NOT_FOUND_1, tableAlias); throw Message.getSQLException(ErrorCode.TABLE_OR_VIEW_NOT_FOUND_1, tableAlias);
} }
......
...@@ -70,6 +70,10 @@ public class Wildcard extends Expression { ...@@ -70,6 +70,10 @@ public class Wildcard extends Expression {
return table; return table;
} }
public String getSchemaName() {
return schema;
}
public String getSQL() { public String getSQL() {
if (table == null) { if (table == null) {
return "*"; return "*";
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论