Search in sources :

Example 6 with MySqlOrderingExpr

use of com.alibaba.druid.sql.dialect.mysql.ast.expr.MySqlOrderingExpr in project druid by alibaba.

the class WallVisitorUtils method checkSqlExpr.

public static boolean checkSqlExpr(SQLExpr x) {
    // check groupby, orderby, limit
    if (x == null) {
        return false;
    }
    SQLObject obj = x;
    for (; ; ) {
        SQLObject parent = obj.getParent();
        if (parent == null) {
            return false;
        }
        if (parent instanceof SQLSelectGroupByClause) {
            return true;
        } else if (parent instanceof SQLOrderBy) {
            return true;
        } else if (parent instanceof SQLLimit) {
            return true;
        } else if (parent instanceof MySqlOrderingExpr) {
            return true;
        }
        obj = parent;
    }
}
Also used : SQLOrderBy(com.alibaba.druid.sql.ast.SQLOrderBy) MySqlOrderingExpr(com.alibaba.druid.sql.dialect.mysql.ast.expr.MySqlOrderingExpr) SQLObject(com.alibaba.druid.sql.ast.SQLObject) SQLLimit(com.alibaba.druid.sql.ast.SQLLimit)

Aggregations

MySqlOrderingExpr (com.alibaba.druid.sql.dialect.mysql.ast.expr.MySqlOrderingExpr)6 SQLExpr (com.alibaba.druid.sql.ast.SQLExpr)3 SQLName (com.alibaba.druid.sql.ast.SQLName)3 MySqlUnique (com.alibaba.druid.sql.dialect.mysql.ast.MySqlUnique)2 SQLLimit (com.alibaba.druid.sql.ast.SQLLimit)1 SQLObject (com.alibaba.druid.sql.ast.SQLObject)1 SQLOrderBy (com.alibaba.druid.sql.ast.SQLOrderBy)1 SQLTableConstraint (com.alibaba.druid.sql.ast.statement.SQLTableConstraint)1 MySqlKey (com.alibaba.druid.sql.dialect.mysql.ast.MySqlKey)1 MySqlPrimaryKey (com.alibaba.druid.sql.dialect.mysql.ast.MySqlPrimaryKey)1 MysqlForeignKey (com.alibaba.druid.sql.dialect.mysql.ast.MysqlForeignKey)1 ParserException (com.alibaba.druid.sql.parser.ParserException)1