Package com.alibaba.druid.sql.ast

Examples of com.alibaba.druid.sql.ast.SQLObject


        v.incrementReplaceCunt();
        return false;
    }

    public static boolean visit(ParameterizedVisitor v, SQLNullExpr x) {
        SQLObject parent = x.getParent();
        if (parent instanceof SQLBinaryOpExpr) {
            SQLBinaryOpExpr binaryOpExpr = (SQLBinaryOpExpr) parent;
            if (binaryOpExpr.getOperator() == SQLBinaryOperator.IsNot
                || binaryOpExpr.getOperator() == SQLBinaryOperator.Is) {
                v.print("NULL");
View Full Code Here


    }

    public static SQLBinaryOpExpr merge(ParameterizedVisitor v, SQLBinaryOpExpr x) {
        SQLExpr left = x.getLeft();
        SQLExpr right = x.getRight();
        SQLObject parent = x.getParent();

        if (left instanceof SQLLiteralExpr && right instanceof SQLLiteralExpr) {
            if (x.getOperator() == SQLBinaryOperator.Equality //
                || x.getOperator() == SQLBinaryOperator.NotEqual) {
                if((left instanceof SQLIntegerExpr) && (right instanceof SQLIntegerExpr) ) {
View Full Code Here

    }

    public boolean visit(SQLPropertyExpr x) {
        if (x.getOwner() instanceof SQLVariantRefExpr) {
            SQLVariantRefExpr varExpr = (SQLVariantRefExpr) x.getOwner();
            SQLObject parent = x.getParent();
            String varName = varExpr.getName();
            if (varName.equalsIgnoreCase("@@session") || varName.equalsIgnoreCase("@@global")) {
                if (!(parent instanceof SQLSelectItem) && !(parent instanceof SQLAssignItem)) {
                    violations.add(new IllegalSQLObjectViolation(ErrorCode.VARIANT_DENY,
                                                                 "variable in condition not allow", toSQL(x)));
View Full Code Here

        }

        public void addOrderByColumn(String table, String columnName, SQLObject expr) {
            Column column = new Column(table, columnName);

            SQLObject parent = expr.getParent();
            if (parent instanceof SQLSelectOrderByItem) {
                SQLOrderingSpecification type = ((SQLSelectOrderByItem) parent).getType();
                column.getAttributes().put("orderBy.type", type);
            }
View Full Code Here

        }
    }

    private static boolean isSelectStatmentForMultiTenant(SQLSelectQueryBlock queryBlock) {

        SQLObject parent = queryBlock.getParent();
        while (parent != null) {

            if (parent instanceof SQLUnionQuery) {
                SQLObject x = parent;
                parent = x.getParent();
            } else {
                break;
            }
        }
View Full Code Here

        if (x == null) {
            return true;
        }

        for (;;) {
            SQLObject parent = x.getParent();
            if (!(parent instanceof SQLExpr)) {
                return true;
            }

            if (parent instanceof SQLBinaryOpExpr) {
View Full Code Here

    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;
            }
View Full Code Here

        if (x == null) {
            return false;
        }

        for (;;) {
            SQLObject parent = x.getParent();

            if (parent == null) {
                return false;
            }
View Full Code Here

        if (x instanceof SQLSelectQueryBlock) {
            return (SQLSelectQueryBlock) x;
        }

        SQLObject parent = x.getParent();

        if (parent instanceof SQLExpr) {
            return getQueryBlock(parent);
        }
View Full Code Here

            String owner = ((SQLName) x).getSimpleName();
            owner = WallVisitorUtils.form(owner);
            if (isInTableSource(x) && !visitor.getProvider().checkDenySchema(owner)) {

                if (!isTopStatementWithTableSource(x) && !isFirstSelectTableSource(x) && !isFirstInSubQuery(x)) {
                    SQLObject parent = x.getParent();
                    while (parent != null && !(parent instanceof SQLStatement)) {
                        parent = parent.getParent();
                    }

                    boolean sameToTopSelectSchema = false;
                    if (parent instanceof SQLSelectStatement) {
                        SQLSelectStatement selectStmt = (SQLSelectStatement) parent;
View Full Code Here

TOP

Related Classes of com.alibaba.druid.sql.ast.SQLObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.