Search in sources :

Example 6 with SQLUpdateSetItem

use of com.alibaba.druid.sql.ast.statement.SQLUpdateSetItem in project druid by alibaba.

the class SQLExprParser method parseUpdateSetItem.

public SQLUpdateSetItem parseUpdateSetItem() {
    SQLUpdateSetItem item = new SQLUpdateSetItem();
    if (lexer.token() == (Token.LPAREN)) {
        lexer.nextToken();
        SQLListExpr list = new SQLListExpr();
        this.exprList(list.getItems(), list);
        accept(Token.RPAREN);
        item.setColumn(list);
    } else {
        item.setColumn(this.primary());
    }
    if (lexer.token() == Token.COLONEQ) {
        lexer.nextToken();
    } else {
        accept(Token.EQ);
    }
    item.setValue(this.expr());
    return item;
}
Also used : SQLUpdateSetItem(com.alibaba.druid.sql.ast.statement.SQLUpdateSetItem)

Aggregations

SQLUpdateSetItem (com.alibaba.druid.sql.ast.statement.SQLUpdateSetItem)6 SQLExpr (com.alibaba.druid.sql.ast.SQLExpr)2 SQLUpdateStatement (com.alibaba.druid.sql.ast.statement.SQLUpdateStatement)2 SQLOrderBy (com.alibaba.druid.sql.ast.SQLOrderBy)1 SQLOrderingSpecification (com.alibaba.druid.sql.ast.SQLOrderingSpecification)1 SQLStatement (com.alibaba.druid.sql.ast.SQLStatement)1 SQLInSubQueryExpr (com.alibaba.druid.sql.ast.expr.SQLInSubQueryExpr)1 SQLConstraint (com.alibaba.druid.sql.ast.statement.SQLConstraint)1 SQLSelectOrderByItem (com.alibaba.druid.sql.ast.statement.SQLSelectOrderByItem)1 SQLTableSource (com.alibaba.druid.sql.ast.statement.SQLTableSource)1 Limit (com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlSelectQueryBlock.Limit)1 MySqlUpdateStatement (com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlUpdateStatement)1 MySqlStatementParser (com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser)1 SQLNonTransientException (java.sql.SQLNonTransientException)1