use of com.alibaba.druid.sql.dialect.mysql.ast.expr.MySqlExpr in project druid by alibaba.
the class SchemaStatVisitor method visit.
public boolean visit(SQLOrderBy x) {
final SQLASTVisitor orderByVisitor = createOrderByVisitor(x);
SQLSelectQueryBlock query = null;
if (x.getParent() instanceof SQLSelectQueryBlock) {
query = (SQLSelectQueryBlock) x.getParent();
}
if (query != null) {
for (SQLSelectOrderByItem item : x.getItems()) {
SQLExpr expr = item.getExpr();
if (expr instanceof SQLIntegerExpr) {
int intValue = ((SQLIntegerExpr) expr).getNumber().intValue() - 1;
if (intValue < query.getSelectList().size()) {
SQLSelectItem selectItem = query.getSelectList().get(intValue);
selectItem.getExpr().accept(orderByVisitor);
}
} else if (expr instanceof MySqlExpr || expr instanceof OracleExpr) {
continue;
}
}
}
x.accept(orderByVisitor);
return true;
}
Aggregations