Search in sources :

Example 1 with SubqueryAnyExpression

use of com.alibaba.cobar.parser.ast.expression.misc.SubqueryAnyExpression in project cobar by alibaba.

the class MySQLExprParser method anyAllExpression.

private Expression anyAllExpression() throws SQLSyntaxErrorException {
    QueryExpression subquery = null;
    switch(lexer.token()) {
        case KW_ALL:
            lexer.nextToken();
            match(PUNC_LEFT_PAREN);
            subquery = subQuery();
            match(PUNC_RIGHT_PAREN);
            return new SubqueryAllExpression(subquery).setCacheEvalRst(cacheEvalRst);
        default:
            int matchIndex = equalsIdentifier("SOME", "ANY");
            if (matchIndex < 0) {
                return bitOrExpression(null, null);
            }
            String consumed = lexer.stringValue();
            String consumedUp = lexer.stringValueUppercase();
            if (lexer.nextToken() == PUNC_LEFT_PAREN) {
                lexer.nextToken();
                subquery = subQuery();
                match(PUNC_RIGHT_PAREN);
                return new SubqueryAnyExpression(subquery).setCacheEvalRst(cacheEvalRst);
            }
            return bitOrExpression(consumed, consumedUp);
    }
}
Also used : SubqueryAllExpression(com.alibaba.cobar.parser.ast.expression.misc.SubqueryAllExpression) SubqueryAnyExpression(com.alibaba.cobar.parser.ast.expression.misc.SubqueryAnyExpression) LiteralString(com.alibaba.cobar.parser.ast.expression.primary.literal.LiteralString) QueryExpression(com.alibaba.cobar.parser.ast.expression.misc.QueryExpression)

Aggregations

QueryExpression (com.alibaba.cobar.parser.ast.expression.misc.QueryExpression)1 SubqueryAllExpression (com.alibaba.cobar.parser.ast.expression.misc.SubqueryAllExpression)1 SubqueryAnyExpression (com.alibaba.cobar.parser.ast.expression.misc.SubqueryAnyExpression)1 LiteralString (com.alibaba.cobar.parser.ast.expression.primary.literal.LiteralString)1