• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java CaseWhenOperatorExpression类的典型用法和代码示例

java 2次浏览

本文整理汇总了Java中com.alibaba.cobar.parser.ast.expression.primary.CaseWhenOperatorExpression的典型用法代码示例。如果您正苦于以下问题:Java CaseWhenOperatorExpression类的具体用法?Java CaseWhenOperatorExpression怎么用?Java CaseWhenOperatorExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

CaseWhenOperatorExpression类属于com.alibaba.cobar.parser.ast.expression.primary包,在下文中一共展示了CaseWhenOperatorExpression类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: visit

点赞 3

import com.alibaba.cobar.parser.ast.expression.primary.CaseWhenOperatorExpression; //导入依赖的package包/类
@Override
public void visit(CaseWhenOperatorExpression node) {
    appendable.append("CASE");
    Expression comparee = node.getComparee();
    if (comparee != null) {
        appendable.append(' ');
        comparee.accept(this);
    }
    List<Pair<Expression, Expression>> whenList = node.getWhenList();
    for (Pair<Expression, Expression> whenthen : whenList) {
        appendable.append(" WHEN ");
        Expression when = whenthen.getKey();
        when.accept(this);
        appendable.append(" THEN ");
        Expression then = whenthen.getValue();
        then.accept(this);
    }
    Expression elseRst = node.getElseResult();
    if (elseRst != null) {
        appendable.append(" ELSE ");
        elseRst.accept(this);
    }
    appendable.append(" END");
}
 

开发者ID:loye168,
项目名称:tddl5,
代码行数:25,
代码来源:MySQLOutputASTVisitor.java

示例2: caseWhenExpression

点赞 2

import com.alibaba.cobar.parser.ast.expression.primary.CaseWhenOperatorExpression; //导入依赖的package包/类
/**
 * first <code>CASE</code> has been consumed
 */
private Expression caseWhenExpression() throws SQLSyntaxErrorException {
    Expression comparee = null;
    if (lexer.token() != KW_WHEN) {
        comparee = expression();
    }
    List<Pair<Expression, Expression>> list = new LinkedList<Pair<Expression, Expression>>();
    for (; lexer.token() == KW_WHEN;) {
        lexer.nextToken();
        Expression when = expression();
        match(KW_THEN);
        Expression then = expression();
        if (when == null || then == null) throw err("when or then is null in CASE WHEN expression");
        list.add(new Pair<Expression, Expression>(when, then));
    }
    if (list.isEmpty()) {
        throw err("at least one WHEN ... THEN branch for CASE ... WHEN syntax");
    }
    Expression elseValue = null;
    switch (lexer.token()) {
        case KW_ELSE:
            lexer.nextToken();
            elseValue = expression();
        default:
            matchIdentifier("END");
    }
    return new CaseWhenOperatorExpression(comparee, list, elseValue).setCacheEvalRst(cacheEvalRst);
}
 

开发者ID:loye168,
项目名称:tddl5,
代码行数:31,
代码来源:MySQLExprParser.java

示例3: caseWhenExpression

点赞 2

import com.alibaba.cobar.parser.ast.expression.primary.CaseWhenOperatorExpression; //导入依赖的package包/类
/**
 * first <code>CASE</code> has been consumed
 */
private Expression caseWhenExpression() throws SQLSyntaxErrorException {
    Expression comparee = null;
    if (lexer.token() != KW_WHEN) {
        comparee = expression();
    }
    List<Pair<Expression, Expression>> list = new LinkedList<Pair<Expression, Expression>>();
    for (; lexer.token() == KW_WHEN;) {
        lexer.nextToken();
        Expression when = expression();
        match(KW_THEN);
        Expression then = expression();
        if (when == null || then == null)
            throw err("when or then is null in CASE WHEN expression");
        list.add(new Pair<Expression, Expression>(when, then));
    }
    if (list.isEmpty()) {
        throw err("at least one WHEN ... THEN branch for CASE ... WHEN syntax");
    }
    Expression elseValue = null;
    switch (lexer.token()) {
    case KW_ELSE:
        lexer.nextToken();
        elseValue = expression();
    default:
        matchIdentifier("END");
    }
    return new CaseWhenOperatorExpression(comparee, list, elseValue).setCacheEvalRst(cacheEvalRst);
}
 

开发者ID:alibaba,
项目名称:cobar,
代码行数:32,
代码来源:MySQLExprParser.java

示例4: visit

点赞 2

import com.alibaba.cobar.parser.ast.expression.primary.CaseWhenOperatorExpression; //导入依赖的package包/类
@Override
public void visit(CaseWhenOperatorExpression node) {
    visitChild(2, false, false, node.getComparee(), node.getElseResult());
    List<Pair<Expression, Expression>> whenPairList = node.getWhenList();
    if (whenPairList == null || whenPairList.isEmpty())
        return;
    List<Expression> list = new ArrayList<Expression>(whenPairList.size() * 2);
    for (Pair<Expression, Expression> pair : whenPairList) {
        if (pair == null)
            continue;
        list.add(pair.getKey());
        list.add(pair.getValue());
    }
    visitChild(2, false, false, list);
}
 

开发者ID:alibaba,
项目名称:cobar,
代码行数:16,
代码来源:PartitionKeyVisitor.java

示例5: visit

点赞 2

import com.alibaba.cobar.parser.ast.expression.primary.CaseWhenOperatorExpression; //导入依赖的package包/类
@Override
public void visit(CaseWhenOperatorExpression node) {
    visitInternal(node.getComparee());
    visitInternal(node.getElseResult());
    visitInternal(node.getWhenList());
}
 

开发者ID:loye168,
项目名称:tddl5,
代码行数:7,
代码来源:EmptySQLASTVisitor.java

示例6: visit

点赞 2

import com.alibaba.cobar.parser.ast.expression.primary.CaseWhenOperatorExpression; //导入依赖的package包/类
@Override
public void visit(CaseWhenOperatorExpression node) {
    throw new NotSupportException("CaseWhenOperatorExpression");
}
 

开发者ID:beebeandwer,
项目名称:TDDL,
代码行数:5,
代码来源:MySqlExprVisitor.java

示例7: visit

点赞 1

import com.alibaba.cobar.parser.ast.expression.primary.CaseWhenOperatorExpression; //导入依赖的package包/类
void visit(CaseWhenOperatorExpression node); 

开发者ID:loye168,
项目名称:tddl5,
代码行数:2,
代码来源:SQLASTVisitor.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)