当前位置: 首页>>代码示例>>Java>>正文


Java CaseExpression.getWhenClauses方法代码示例

本文整理汇总了Java中net.sf.jsqlparser.expression.CaseExpression.getWhenClauses方法的典型用法代码示例。如果您正苦于以下问题:Java CaseExpression.getWhenClauses方法的具体用法?Java CaseExpression.getWhenClauses怎么用?Java CaseExpression.getWhenClauses使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.sf.jsqlparser.expression.CaseExpression的用法示例。


在下文中一共展示了CaseExpression.getWhenClauses方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: visit

import net.sf.jsqlparser.expression.CaseExpression; //导入方法依赖的package包/类
@Override
public void visit(CaseExpression caseExpression) {
    buffer.append("CASE ");
    Expression switchExp = caseExpression.getSwitchExpression();
    if (switchExp != null) {
        switchExp.accept(this);
        buffer.append(" ");
    }

    for (Expression exp : caseExpression.getWhenClauses()) {
        exp.accept(this);
    }

    Expression elseExp = caseExpression.getElseExpression();
    if (elseExp != null) {
        buffer.append("ELSE ");
        elseExp.accept(this);
        buffer.append(" ");
    }

    buffer.append("END");
}
 
开发者ID:WeiMei-Tian,项目名称:editor-sql,代码行数:23,代码来源:ExpressionDeParser.java

示例2: visit

import net.sf.jsqlparser.expression.CaseExpression; //导入方法依赖的package包/类
public void visit(CaseExpression caseExpression) {
    buffer.append(caseExpression.getCommentCase() != null ? caseExpression.getCommentElse() + " " + ExpressionDeParser.LINE_SEPARATOR : "").append("Case ");
    Expression switchExp = caseExpression.getSwitchExpression();
    if (switchExp != null) {
        switchExp.accept(this);
    }
    List clauses = caseExpression.getWhenClauses();
    for (Iterator iter = clauses.iterator(); iter.hasNext();) {
        Expression exp = (Expression) iter.next();
        exp.accept(this);
    }
    Expression elseExp = caseExpression.getElseExpression();
    if (elseExp != null) {
        elseExp.accept(this);
    }
    buffer.append(caseExpression.getCommentEnd() != null ? " " + caseExpression.getCommentEnd() + ExpressionDeParser.LINE_SEPARATOR : "").append(" End");
}
 
开发者ID:marat-gainullin,项目名称:platypus-js,代码行数:18,代码来源:ExpressionDeParser.java

示例3: create

import net.sf.jsqlparser.expression.CaseExpression; //导入方法依赖的package包/类
public static CompiledCaseExpression create(String validatedTableAlias, CaseExpression caseExpression) {
    Expression switchExpression = caseExpression.getSwitchExpression();
    if (switchExpression != null) {
        throw new StatementExecutionException("unhandled expression CASE SWITCH, type " + caseExpression.getClass() + ": " + caseExpression);
    }
    List<Entry<CompiledSQLExpression, CompiledSQLExpression>> whens = null;
    if (caseExpression.getWhenClauses() != null) {
        whens = new ArrayList<>();
        for (Expression when : caseExpression.getWhenClauses()) {
            WhenClause whenClause = (WhenClause) when;
            CompiledSQLExpression whenCondition = compileExpression(validatedTableAlias, whenClause.getWhenExpression());
            if (whenCondition == null) {
                return null;
            }
            CompiledSQLExpression thenExpr = compileExpression(validatedTableAlias, whenClause.getThenExpression());
            whens.add(new AbstractMap.SimpleImmutableEntry<>(whenCondition, thenExpr));
        }
    }
    Expression elseExp = caseExpression.getElseExpression();
    if (elseExp != null) {
        CompiledSQLExpression elseExpression = compileExpression(validatedTableAlias, elseExp);
        if (elseExpression == null) {
            return null;
        }
        return new CompiledCaseExpression(whens, elseExpression);
    } else {
        return new CompiledCaseExpression(whens, null);
    }
}
 
开发者ID:diennea,项目名称:herddb,代码行数:30,代码来源:CompiledCaseExpression.java

示例4: visit

import net.sf.jsqlparser.expression.CaseExpression; //导入方法依赖的package包/类
@Override
public void visit(CaseExpression caseExpression) {
    if (caseExpression.getSwitchExpression() != null) {
        caseExpression.getSwitchExpression().accept(this);
    }
    if (caseExpression.getWhenClauses() != null) {
        caseExpression.getWhenClauses().forEach(e -> e.accept(this));
    }
    if (caseExpression.getElseExpression() != null) {
        caseExpression.getElseExpression().accept(this);
    }
}
 
开发者ID:diennea,项目名称:herddb,代码行数:13,代码来源:JdbcQueryRewriter.java


注:本文中的net.sf.jsqlparser.expression.CaseExpression.getWhenClauses方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。