use of com.alibaba.druid.stat.TableStat.Relationship in project druid by alibaba.
the class OracleSchemaStatVisitor method visit.
@Override
public boolean visit(OracleSelectJoin x) {
super.visit(x);
for (SQLExpr item : x.getUsing()) {
if (item instanceof SQLIdentifierExpr) {
String columnName = ((SQLIdentifierExpr) item).getName();
String leftTable = (String) x.getLeft().getAttribute(ATTR_TABLE);
String rightTable = (String) x.getRight().getAttribute(ATTR_TABLE);
if (leftTable != null && rightTable != null) {
Relationship relationship = new Relationship();
relationship.setLeft(new Column(leftTable, columnName));
relationship.setRight(new Column(rightTable, columnName));
relationship.setOperator("USING");
relationships.add(relationship);
}
if (leftTable != null) {
addColumn(leftTable, columnName);
}
if (rightTable != null) {
addColumn(rightTable, columnName);
}
}
}
return false;
}
use of com.alibaba.druid.stat.TableStat.Relationship in project druid by alibaba.
the class SchemaStatVisitor method handleRelationship.
protected void handleRelationship(SQLExpr left, String operator, SQLExpr right) {
Column leftColumn = getColumn(left);
if (leftColumn == null) {
return;
}
Column rightColumn = getColumn(right);
if (rightColumn == null) {
return;
}
Relationship relationship = new Relationship();
relationship.setLeft(leftColumn);
relationship.setRight(rightColumn);
relationship.setOperator(operator);
this.relationships.add(relationship);
}
Aggregations