mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
db2 sql parser support hierarchical.
This commit is contained in:
@@ -27,26 +27,28 @@ import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
public class SQLSelectQueryBlock extends SQLObjectImpl implements SQLSelectQuery {
|
||||
|
||||
protected int distionOption;
|
||||
protected final List<SQLSelectItem> selectList = new ArrayList<SQLSelectItem>();
|
||||
protected final List<SQLSelectItem> selectList = new ArrayList<SQLSelectItem>();
|
||||
|
||||
protected SQLTableSource from;
|
||||
protected SQLExprTableSource into;
|
||||
protected SQLExpr where;
|
||||
|
||||
// for oracle & oceanbase
|
||||
protected SQLExpr startWith;
|
||||
protected SQLExpr connectBy;
|
||||
protected boolean prior = false;
|
||||
protected boolean noCycle = false;
|
||||
protected SQLOrderBy orderBySiblings;
|
||||
|
||||
protected SQLSelectGroupByClause groupBy;
|
||||
protected SQLOrderBy orderBy;
|
||||
protected boolean parenthesized = false;
|
||||
protected boolean forUpdate = false;
|
||||
protected boolean noWait = false;
|
||||
protected boolean parenthesized = false;
|
||||
protected boolean forUpdate = false;
|
||||
protected boolean noWait = false;
|
||||
protected SQLExpr waitTime;
|
||||
|
||||
protected SQLLimit limit;
|
||||
|
||||
// for oracle & oceanbase
|
||||
protected SQLExpr startWith;
|
||||
protected SQLExpr connectBy;
|
||||
protected boolean prior = false;
|
||||
protected boolean noCycle = false;
|
||||
|
||||
public SQLSelectQueryBlock(){
|
||||
|
||||
}
|
||||
@@ -100,6 +102,17 @@ public class SQLSelectQueryBlock extends SQLObjectImpl implements SQLSelectQuery
|
||||
this.orderBy = orderBy;
|
||||
}
|
||||
|
||||
public SQLOrderBy getOrderBySiblings() {
|
||||
return orderBySiblings;
|
||||
}
|
||||
|
||||
public void setOrderBySiblings(SQLOrderBy orderBySiblings) {
|
||||
if (orderBySiblings != null) {
|
||||
orderBySiblings.setParent(this);
|
||||
}
|
||||
this.orderBySiblings = orderBySiblings;
|
||||
}
|
||||
|
||||
public int getDistionOption() {
|
||||
return this.distionOption;
|
||||
}
|
||||
|
||||
@@ -76,6 +76,8 @@ public class DB2SelectParser extends SQLSelectParser {
|
||||
|
||||
parseWhere(queryBlock);
|
||||
|
||||
parseHierachical(queryBlock);
|
||||
|
||||
parseGroupBy(queryBlock);
|
||||
|
||||
if (lexer.token() == Token.ORDER) {
|
||||
|
||||
@@ -1089,6 +1089,8 @@ public class SQLASTOutputVisitor extends SQLASTVisitorAdapter implements Paramet
|
||||
where.accept(this);
|
||||
}
|
||||
|
||||
printHierarchical(x);
|
||||
|
||||
if (x.getGroupBy() != null) {
|
||||
println();
|
||||
x.getGroupBy().accept(this);
|
||||
|
||||
Reference in New Issue
Block a user