Examples of CaseExpression


Examples of com.puppetlabs.geppetto.pp.CaseExpression

        if(result == null)
          result = defaultCase(theEObject);
        return result;
      }
      case PPPackage.CASE_EXPRESSION: {
        CaseExpression caseExpression = (CaseExpression) theEObject;
        T result = caseCaseExpression(caseExpression);
        if(result == null)
          result = caseExpression(caseExpression);
        if(result == null)
          result = defaultCase(theEObject);
View Full Code Here

Examples of com.salesforce.phoenix.expression.CaseExpression

        return true;
    }
   
    @Override
    public Expression visitLeave(CaseParseNode node, List<Expression> l) throws SQLException {
        final CaseExpression caseExpression = new CaseExpression(l);
        for (int i = 0; i < node.getChildren().size(); i+=2) {
            ParseNode childNode = node.getChildren().get(i);
            if (childNode instanceof BindParseNode) {
                context.getBindManager().addParamMetaData((BindParseNode)childNode, new DelegateDatum(caseExpression));
            }
        }
        if (node.isStateless()) {
            ImmutableBytesWritable ptr = context.getTempPtr();
            int index = caseExpression.evaluateIndexOf(null, ptr);
            if (index < 0) {
                return LiteralExpression.newConstant(null, isDeterministic(l));
            }
            return caseExpression.getChildren().get(index);
        }
        return wrapGroupByExpression(caseExpression);
    }
View Full Code Here

Examples of net.sf.jsqlparser.expression.CaseExpression

        {if (true) return retval;}
    throw new Error("Missing return statement in function");
  }

  final public Expression CaseWhenExpression() throws ParseException {
        CaseExpression caseExp = new CaseExpression();
        Expression switchExp = null;
        WhenClause clause;
        List whenClauses = new ArrayList();
        Expression elseExp = null;
    jj_consume_token(K_CASE);
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case K_WHEN:
      label_25:
      while (true) {
        clause = WhenThenSearchCondition();
                                                 whenClauses.add(clause);
        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
        case K_WHEN:
          ;
          break;
        default:
          jj_la1[122] = jj_gen;
          break label_25;
        }
      }
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case K_ELSE:
        jj_consume_token(K_ELSE);
        elseExp = PrimaryExpression();
        break;
      default:
        jj_la1[123] = jj_gen;
        ;
      }
      break;
    case K_NULL:
    case K_CASE:
    case K_REPLACE:
    case S_DOUBLE:
    case S_INTEGER:
    case S_IDENTIFIER:
    case S_CHAR_LITERAL:
    case S_QUOTED_IDENTIFIER:
    case 79:
    case 83:
    case 94:
    case 95:
    case 98:
    case 100:
    case 101:
    case 102:
      switchExp = PrimaryExpression();
      label_26:
      while (true) {
        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
        case K_WHEN:
          ;
          break;
        default:
          jj_la1[124] = jj_gen;
          break label_26;
        }
        clause = WhenThenValue();
                                        whenClauses.add(clause);
      }
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case K_ELSE:
        jj_consume_token(K_ELSE);
        elseExp = PrimaryExpression();
        break;
      default:
        jj_la1[125] = jj_gen;
        ;
      }
      break;
    default:
      jj_la1[126] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
    jj_consume_token(K_END);
        caseExp.setSwitchExpression(switchExp);
        caseExp.setWhenClauses(whenClauses);
                caseExp.setElseExpression(elseExp);
        {if (true) return caseExp;}
    throw new Error("Missing return statement in function");
  }
View Full Code Here

Examples of net.sf.jsqlparser.expression.CaseExpression

                WhenClause qWhen = (WhenClause) qualify(session, tableAliases, whenClause);
                whenClauses.add(qWhen);
            }
        }

        CaseExpression qualifiedWhen = new CaseExpression();
        qualifiedWhen.setElseExpression(elseExpr);
        qualifiedWhen.setSwitchExpression(switchExpr);
        qualifiedWhen.setWhenClauses(whenClauses);
        this._qualifiedExpression = qualifiedWhen;
    }
View Full Code Here

Examples of org.apache.phoenix.expression.CaseExpression

        return true;
    }
   
    @Override
    public Expression visitLeave(CaseParseNode node, List<Expression> l) throws SQLException {
        final CaseExpression caseExpression = new CaseExpression(l);
        for (int i = 0; i < node.getChildren().size(); i+=2) {
            ParseNode childNode = node.getChildren().get(i);
            if (childNode instanceof BindParseNode) {
                context.getBindManager().addParamMetaData((BindParseNode)childNode, new DelegateDatum(caseExpression));
            }
        }
        if (ExpressionUtil.isConstant(caseExpression)) {
            ImmutableBytesWritable ptr = context.getTempPtr();
            int index = caseExpression.evaluateIndexOf(null, ptr);
            if (index < 0) {
                return LiteralExpression.newConstant(null, isDeterministic(l));
            }
            return caseExpression.getChildren().get(index);
        }
        return wrapGroupByExpression(caseExpression);
    }
View Full Code Here

Examples of org.apache.phoenix.expression.CaseExpression

        return true;
    }

    @Override
    public Expression visitLeave(CaseParseNode node, List<Expression> l) throws SQLException {
        final CaseExpression caseExpression = new CaseExpression(l);
        for (int i = 0; i < node.getChildren().size(); i+=2) {
            ParseNode childNode = node.getChildren().get(i);
            if (childNode instanceof BindParseNode) {
                context.getBindManager().addParamMetaData((BindParseNode)childNode, new DelegateDatum(caseExpression));
            }
        }
        if (node.isConstant()) {
            ImmutableBytesWritable ptr = context.getTempPtr();
            int index = caseExpression.evaluateIndexOf(null, ptr);
            if (index < 0) {
                return LiteralExpression.NULL_EXPRESSION;
            }
            return caseExpression.getChildren().get(index);
        }
        return wrapGroupByExpression(caseExpression);
    }
View Full Code Here

Examples of org.apache.phoenix.expression.CaseExpression

        return true;
    }
   
    @Override
    public Expression visitLeave(CaseParseNode node, List<Expression> l) throws SQLException {
        final CaseExpression caseExpression = new CaseExpression(l);
        for (int i = 0; i < node.getChildren().size(); i+=2) {
            ParseNode childNode = node.getChildren().get(i);
            if (childNode instanceof BindParseNode) {
                context.getBindManager().addParamMetaData((BindParseNode)childNode, new DelegateDatum(caseExpression));
            }
        }
        if (ExpressionUtil.isConstant(caseExpression)) {
            ImmutableBytesWritable ptr = context.getTempPtr();
            int index = caseExpression.evaluateIndexOf(null, ptr);
            if (index < 0) {
                return LiteralExpression.newConstant(null, isDeterministic(l));
            }
            return caseExpression.getChildren().get(index);
        }
        return wrapGroupByExpression(caseExpression);
    }
View Full Code Here

Examples of org.apache.phoenix.expression.CaseExpression

        return true;
    }
   
    @Override
    public Expression visitLeave(CaseParseNode node, List<Expression> l) throws SQLException {
        final CaseExpression caseExpression = new CaseExpression(l);
        for (int i = 0; i < node.getChildren().size(); i+=2) {
            ParseNode childNode = node.getChildren().get(i);
            if (childNode instanceof BindParseNode) {
                context.getBindManager().addParamMetaData((BindParseNode)childNode, new DelegateDatum(caseExpression));
            }
        }
        if (node.isStateless()) {
            ImmutableBytesWritable ptr = context.getTempPtr();
            int index = caseExpression.evaluateIndexOf(null, ptr);
            if (index < 0) {
                return LiteralExpression.newConstant(null, isDeterministic(l));
            }
            return caseExpression.getChildren().get(index);
        }
        return wrapGroupByExpression(caseExpression);
    }
View Full Code Here

Examples of org.datanucleus.store.rdbms.sql.expression.CaseExpression

                NumericExpression posExpr1 = new NumericExpression(locateExpr, Expression.OP_SUB, oneExpr);
                actionExprs[0] = new NumericExpression(posExpr1, Expression.OP_ADD, fromExpr);

                SQLExpression elseExpr = new IntegerLiteral(stmt, exprFactory.getMappingForType(Integer.class, false), Integer.valueOf(-1), null);

                return new CaseExpression(whenExprs, actionExprs, elseExpr);
            }
        }
    }
View Full Code Here

Examples of org.eclipse.persistence.jpa.jpql.parser.CaseExpression

    if (stateObject.isDecorated()) {
      toText(stateObject);
    }
    else {
      CaseExpression expression = stateObject.getExpression();

      // 'CASE'
      appendIdentifier((expression != null) ? expression.getActualCaseIdentifier() : CASE, CASE);

      if (shouldOutput(expression) || expression.hasSpaceAfterCase()) {
        writer.append(SPACE);
      }

      // Case operand
      if (stateObject.hasCaseOperand()) {
        stateObject.getCaseOperand().accept(this);

        if (shouldOutput(expression) || expression.hasSpaceAfterCaseOperand()) {
          writer.append(SPACE);
        }
      }

      // WHEN clauses
      if (stateObject.hasItems()) {
        toStringChildren(stateObject, false);
      }

      if (shouldOutput(expression) || expression.hasSpaceAfterWhenClauses()) {
        writer.append(SPACE);
      }

      // 'ELSE'
      if (shouldOutput(expression) || expression.hasElse()) {
        appendIdentifier((expression != null) ? expression.getActualElseIdentifier() : ELSE, ELSE);
      }

      if (shouldOutput(expression) || expression.hasSpaceAfterElse()) {
        writer.append(SPACE);
      }

      // Else expression
      if (stateObject.hasElse()) {
        stateObject.getElse().accept(this);
      }

      if (shouldOutput(expression) || expression.hasSpaceAfterElseExpression()) {
        writer.append(SPACE);
      }

      // END
      if (shouldOutput(expression) || expression.hasEnd()) {
        appendIdentifier((expression != null) ? expression.getActualEndIdentifier() : END, END);
      }
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.