bug fixed for oracle sql parser schemastat visitor

This commit is contained in:
wenshao
2016-08-24 15:18:41 +08:00
parent e8aecf29bb
commit 89575d14de
4 changed files with 45 additions and 16 deletions
@@ -512,7 +512,11 @@ public class OracleExprParser extends SQLExprParser {
if (lexer.token() != Token.FROM) {
SQLExpr trim_character = this.primary();
trim_character.setParent(methodExpr);
methodExpr.putAttribute("trim_character", trim_character);
if (trim_character instanceof SQLCharExpr) {
methodExpr.putAttribute("trim_character", trim_character);
} else {
methodExpr.getParameters().add(trim_character);
}
}
if (lexer.token() == Token.FROM) {
@@ -498,19 +498,7 @@ public class OracleSchemaStatVisitor extends SchemaStatVisitor implements Oracle
@Override
public boolean visit(OracleSelectJoin x) {
x.getLeft().accept(this);
x.getRight().accept(this);
{
String leftTable = (String) x.getLeft().getAttribute(ATTR_TABLE);
String rightTable = (String) x.getRight().getAttribute(ATTR_TABLE);
if (leftTable != null && leftTable.equals(rightTable)) {
x.putAttribute(ATTR_TABLE, leftTable);
}
}
if (x.getCondition() != null) {
x.getCondition().accept(this);
}
super.visit(x);
for (SQLExpr item : x.getUsing()) {
if (item instanceof SQLIdentifierExpr) {
@@ -736,8 +736,9 @@ public class SchemaStatVisitor extends SQLASTVisitorAdapter {
public boolean visit(SQLJoinTableSource x) {
x.getLeft().accept(this);
x.getRight().accept(this);
if (x.getCondition() != null) {
x.getCondition().accept(this);
SQLExpr condition = x.getCondition();
if (condition != null) {
condition.accept(this);
}
return false;
}