use of com.alibaba.druid.sql.dialect.db2.visitor.DB2ASTVisitorAdapter in project druid by alibaba.
the class Issue2038 method test_for_demo.
public void test_for_demo() throws Exception {
String sql = "select * from (select * from t union all select * from t1 union all select * from t3) xx";
List<SQLStatement> stmtList = SQLUtils.parseStatements(sql, DbType.db2);
SQLASTVisitor visitor = new DB2ASTVisitorAdapter() {
public boolean visit(SQLUnionQuery x) {
System.out.println("union");
return true;
}
public boolean visit(DB2SelectQueryBlock x) {
System.out.println("select");
return true;
}
};
for (SQLStatement stmt : stmtList) {
stmt.accept(visitor);
}
}
Aggregations