@Override public void visit(WithItem withItem) throws Exception { // TODO: Redo this later. What's withItem list. // Add with name here. if (withItem.getName() != null) { this.withTableNameList.add(withItem.getName()); } withItem.getSelectBody().accept(this); if (withItem.getWithItemList() != null) { for (SelectItem selectItem : withItem.getWithItemList()) { selectItem.accept(this); } } }
/** * @brief Visit the statement. This is the function that should be called in the first place. * @param statement A SQL statement. */ public void visit(Statement statement) throws Exception { if (statement instanceof Select) { Select select = (Select) statement; if (select.getWithItemsList() != null) { for (WithItem withItem : ((Select) statement).getWithItemsList()) { withItem.accept(this); } } if (select.getSelectBody() != null) { select.getSelectBody().accept(this); } } else if (statement instanceof DescribeTable) { ((DescribeTable) statement).accept(this); } // TODO: Add more type support here. }