Package com.alibaba.druid.sql.dialect.mysql.ast.statement

Examples of com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlUpdateStatement


    public SQLSelectStatement parseSelect() {
        return new SQLSelectStatement(new MySqlSelectParser(this.exprParser).select());
    }

    public SQLUpdateStatement parseUpdateStatement() {
        MySqlUpdateStatement stmt = createUpdateStatement();

        if (lexer.token() == Token.UPDATE) {
            lexer.nextToken();

            if (identifierEquals(LOW_PRIORITY)) {
                lexer.nextToken();
                stmt.setLowPriority(true);
            }

            if (identifierEquals(IGNORE)) {
                lexer.nextToken();
                stmt.setIgnore(true);
            }

            SQLTableSource tableSource = this.exprParser.createSelectParser().parseTableSource();
            stmt.setTableSource(tableSource);
        }

        accept(Token.SET);

        for (;;) {
            SQLUpdateSetItem item = new SQLUpdateSetItem();
            item.setColumn(this.exprParser.name());
            if (lexer.token() == Token.EQ) {
                lexer.nextToken();
            } else {
                accept(Token.COLONEQ);
            }
            item.setValue(this.exprParser.expr());

            stmt.getItems().add(item);

            if (lexer.token() == (Token.COMMA)) {
                lexer.nextToken();
                continue;
            }

            break;
        }

        if (lexer.token() == (Token.WHERE)) {
            lexer.nextToken();
            stmt.setWhere(this.exprParser.expr());
        }

        stmt.setOrderBy(this.exprParser.parseOrderBy());

        stmt.setLimit(parseLimit());

        return stmt;
    }
View Full Code Here


        return stmt;
    }

    protected MySqlUpdateStatement createUpdateStatement() {
        return new MySqlUpdateStatement();
    }
View Full Code Here

                context.incrementUpdateNoneConditionWarnnings();
            }

            if (config.isUpdateWhereNoneCheck()) {
                if (x instanceof MySqlUpdateStatement) {
                    MySqlUpdateStatement mysqlUpdate = (MySqlUpdateStatement) x;
                    if (mysqlUpdate.getLimit() == null) {
                        addViolation(visitor, ErrorCode.NONE_CONDITION, "update none condition not allow", x);
                        return;
                    }
                } else {
                    addViolation(visitor, ErrorCode.NONE_CONDITION, "update none condition not allow", x);
View Full Code Here

        MySqlSelectParser selectParser = new MySqlSelectParser(this.exprParser);
        return new SQLSelectStatement(selectParser.select(), JdbcConstants.MYSQL);
    }

    public SQLUpdateStatement parseUpdateStatement() {
        MySqlUpdateStatement stmt = createUpdateStatement();

        if (lexer.token() == Token.UPDATE) {
            lexer.nextToken();

            if (identifierEquals(LOW_PRIORITY)) {
                lexer.nextToken();
                stmt.setLowPriority(true);
            }

            if (identifierEquals(IGNORE)) {
                lexer.nextToken();
                stmt.setIgnore(true);
            }

            SQLTableSource tableSource = this.exprParser.createSelectParser().parseTableSource();
            stmt.setTableSource(tableSource);
        }

        parseUpdateSet(stmt);

        if (lexer.token() == (Token.WHERE)) {
            lexer.nextToken();
            stmt.setWhere(this.exprParser.expr());
        }

        stmt.setOrderBy(this.exprParser.parseOrderBy());

        stmt.setLimit(parseLimit());

        return stmt;
    }
View Full Code Here

        return stmt;
    }

    protected MySqlUpdateStatement createUpdateStatement() {
        return new MySqlUpdateStatement();
    }
View Full Code Here

        MySqlSelectParser selectParser = new MySqlSelectParser(this.exprParser);
        return new SQLSelectStatement(selectParser.select());
    }

    public SQLUpdateStatement parseUpdateStatement() {
        MySqlUpdateStatement stmt = createUpdateStatement();

        if (lexer.token() == Token.UPDATE) {
            lexer.nextToken();

            if (identifierEquals(LOW_PRIORITY)) {
                lexer.nextToken();
                stmt.setLowPriority(true);
            }

            if (identifierEquals(IGNORE)) {
                lexer.nextToken();
                stmt.setIgnore(true);
            }

            SQLTableSource tableSource = this.exprParser.createSelectParser().parseTableSource();
            stmt.setTableSource(tableSource);
        }

        parseUpdateSet(stmt);

        if (lexer.token() == (Token.WHERE)) {
            lexer.nextToken();
            stmt.setWhere(this.exprParser.expr());
        }

        stmt.setOrderBy(this.exprParser.parseOrderBy());

        stmt.setLimit(parseLimit());

        return stmt;
    }
View Full Code Here

        return stmt;
    }

    protected MySqlUpdateStatement createUpdateStatement() {
        return new MySqlUpdateStatement();
    }
View Full Code Here

                context.incrementUpdateNoneConditionWarnnings();
            }

            if (config.isUpdateWhereNoneCheck()) {
                if (x instanceof MySqlUpdateStatement) {
                    MySqlUpdateStatement mysqlUpdate = (MySqlUpdateStatement) x;
                    if (mysqlUpdate.getLimit() == null) {
                        addViolation(visitor, ErrorCode.NONE_CONDITION, "update none condition not allow", x);
                        return;
                    }
                } else {
                    addViolation(visitor, ErrorCode.NONE_CONDITION, "update none condition not allow", x);
View Full Code Here

                context.incrementUpdateNoneConditionWarnings();
            }

            if (config.isUpdateWhereNoneCheck()) {
                if (x instanceof MySqlUpdateStatement) {
                    MySqlUpdateStatement mysqlUpdate = (MySqlUpdateStatement) x;
                    if (mysqlUpdate.getLimit() == null) {
                        addViolation(visitor, ErrorCode.NONE_CONDITION, "update none condition not allow", x);
                        return;
                    }
                } else {
                    addViolation(visitor, ErrorCode.NONE_CONDITION, "update none condition not allow", x);
View Full Code Here

        MySqlSelectParser selectParser = new MySqlSelectParser(this.exprParser);
        return new SQLSelectStatement(selectParser.select());
    }

    public SQLUpdateStatement parseUpdateStatement() {
        MySqlUpdateStatement stmt = createUpdateStatement();

        if (lexer.token() == Token.UPDATE) {
            lexer.nextToken();

            if (identifierEquals(LOW_PRIORITY)) {
                lexer.nextToken();
                stmt.setLowPriority(true);
            }

            if (identifierEquals(IGNORE)) {
                lexer.nextToken();
                stmt.setIgnore(true);
            }

            SQLTableSource tableSource = this.exprParser.createSelectParser().parseTableSource();
            stmt.setTableSource(tableSource);
        }

        parseUpdateSet(stmt);

        if (lexer.token() == (Token.WHERE)) {
            lexer.nextToken();
            stmt.setWhere(this.exprParser.expr());
        }

        stmt.setOrderBy(this.exprParser.parseOrderBy());

        stmt.setLimit(parseLimit());

        return stmt;
    }
View Full Code Here

TOP

Related Classes of com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlUpdateStatement

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.