Examples of SQLSelectQueryBlock


Examples of com.alibaba.druid.sql.ast.statement.SQLSelectQueryBlock

            if (parent == null) {
                break;
            }

            if (parent instanceof SQLSelectQueryBlock) {
                SQLSelectQueryBlock query = (SQLSelectQueryBlock) parent;
                if (query.getWhere() == current) {
                    column.setWhere(true);
                }
                break;
            }
View Full Code Here

Examples of com.alibaba.druid.sql.ast.statement.SQLSelectQueryBlock

            return;
        }

        if (expr instanceof SQLAllColumnExpr //
            && x.getParent() instanceof SQLSelectQueryBlock) {
            SQLSelectQueryBlock queryBlock = (SQLSelectQueryBlock) x.getParent();
            SQLTableSource from = queryBlock.getFrom();

            if (from instanceof SQLExprTableSource) {
                addViolation(visitor, ErrorCode.SELECT_NOT_ALLOW, "'SELECT *' not allow", x);
            }
        }
View Full Code Here

Examples of com.alibaba.druid.sql.ast.statement.SQLSelectQueryBlock

        } else if (parent instanceof SQLUpdateStatement) {
            SQLUpdateStatement updateStmt = (SQLUpdateStatement) parent;
            updateStmt.setWhere(condition);
            visitor.setSqlModified(true);
        } else if (parent instanceof SQLSelectQueryBlock) {
            SQLSelectQueryBlock queryBlock = (SQLSelectQueryBlock) parent;
            queryBlock.setWhere(condition);
            visitor.setSqlModified(true);
        }
    }
View Full Code Here

Examples of com.alibaba.druid.sql.ast.statement.SQLSelectQueryBlock

                    return true;
                }
            }

            if (parent instanceof SQLSelectQueryBlock) {
                SQLSelectQueryBlock query = (SQLSelectQueryBlock) parent;
                if (query.getWhere() == x) {
                    return true;
                }
            }

            if (parent instanceof SQLDeleteStatement) {
View Full Code Here

Examples of com.alibaba.druid.sql.ast.statement.SQLSelectQueryBlock

    public static boolean isSimpleCountTableSource(WallVisitor visitor, SQLSelect select) {
        SQLSelectQuery query = select.getQuery();

        if (query instanceof SQLSelectQueryBlock) {
            SQLSelectQueryBlock queryBlock = (SQLSelectQueryBlock) query;

            boolean allawTrueWhere = false;

            if (queryBlock.getWhere() == null) {
                allawTrueWhere = true;
            } else {
                Object whereValue = getValue(visitor, queryBlock.getWhere());
                if (whereValue == Boolean.TRUE) {
                    allawTrueWhere = true;
                } else if (whereValue == Boolean.FALSE) {
                    return false;
                }
            }
            boolean simpleCount = false;
            if (queryBlock.getSelectList().size() == 1) {
                SQLExpr selectItemExpr = queryBlock.getSelectList().get(0).getExpr();
                if (selectItemExpr instanceof SQLAggregateExpr) {
                    if (((SQLAggregateExpr) selectItemExpr).getMethodName().equalsIgnoreCase("COUNT")) {
                        simpleCount = true;
                    }
                }
View Full Code Here

Examples of com.alibaba.druid.sql.ast.statement.SQLSelectQueryBlock

        if (!(item.getParent() instanceof SQLSelectQueryBlock)) {
            return false;
        }

        SQLSelectQueryBlock queryBlock = (SQLSelectQueryBlock) item.getParent();
        if (!queryBlockFromIsNull(visitor, queryBlock)) {
            return false;
        }

        if (!(queryBlock.getParent() instanceof SQLSelect)) {
            return false;
        }

        SQLSelect select = (SQLSelect) queryBlock.getParent();

        if (!(select.getParent() instanceof SQLSelectStatement)) {
            return false;
        }
View Full Code Here

Examples of com.alibaba.druid.sql.ast.statement.SQLSelectQueryBlock

                    boolean sameToTopSelectSchema = false;
                    if (parent instanceof SQLSelectStatement) {
                        SQLSelectStatement selectStmt = (SQLSelectStatement) parent;
                        SQLSelectQuery query = selectStmt.getSelect().getQuery();
                        if (query instanceof SQLSelectQueryBlock) {
                            SQLSelectQueryBlock queryBlock = (SQLSelectQueryBlock) query;
                            SQLTableSource from = queryBlock.getFrom();

                            while (from instanceof SQLJoinTableSource) {
                                from = ((SQLJoinTableSource) from).getLeft();
                            }
                            if (from instanceof SQLExprTableSource) {
View Full Code Here

Examples of com.alibaba.druid.sql.ast.statement.SQLSelectQueryBlock

        if (!(x instanceof SQLExprTableSource)) {
            return false;
        }

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

            // if (parent instanceof SQLJoinTableSource) {
            // SQLJoinTableSource join = (SQLJoinTableSource) parent;
View Full Code Here

Examples of com.alibaba.druid.sql.ast.statement.SQLSelectQueryBlock

        SQLSelectItem item = (SQLSelectItem) x.getParent();
        if (!(item.getParent() instanceof SQLSelectQueryBlock)) {
            return false;
        }

        SQLSelectQueryBlock queryBlock = (SQLSelectQueryBlock) item.getParent();
        if (!(queryBlock.getParent() instanceof SQLSelect)) {
            return false;
        }

        SQLSelect select = (SQLSelect) queryBlock.getParent();
        if (!(select.getParent() instanceof SQLSelectStatement)) {
            return false;
        }

        SQLSelectStatement stmt = (SQLSelectStatement) select.getParent();
View Full Code Here

Examples of com.alibaba.druid.sql.ast.statement.SQLSelectQueryBlock

                    while (parent instanceof SQLTableSource) {
                        parent = parent.getParent();
                    }

                    if (parent instanceof SQLSelectQueryBlock) {
                        SQLSelectQueryBlock queryBlock = (SQLSelectQueryBlock) parent;
                        if (x == queryBlock.getInto()) {
                            tableStat.incrementSelectIntoCount();
                        } else {
                            tableStat.incrementSelectCount();
                        }
                    } else if (parent instanceof SQLTruncateStatement) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.