Package net.sf.jsqlparser.expression

Examples of net.sf.jsqlparser.expression.Expression


    throw new Error("Missing return statement in function");
  }

  final public WhenClause WhenThenSearchCondition() throws ParseException {
        WhenClause whenThen = new WhenClause();
        Expression whenExp = null;
        Expression thenExp = null;
    jj_consume_token(K_WHEN);
    whenExp = Expression();
    jj_consume_token(K_THEN);
    thenExp = SimpleExpression();
           whenThen.setWhenExpression(whenExp);
View Full Code Here


    throw new Error("Missing return statement in function");
  }

  final public WhenClause WhenThenValue() throws ParseException {
        WhenClause whenThen = new WhenClause();
        Expression whenExp = null;
        Expression thenExp = null;
    jj_consume_token(K_WHEN);
    whenExp = PrimaryExpression();
    jj_consume_token(K_THEN);
    thenExp = SimpleExpression();
           whenThen.setWhenExpression(whenExp);
View Full Code Here

    this.sort=sort;
  }
  Pattern whereReg=Pattern.compile("where[ ]*", Pattern.CASE_INSENSITIVE);
  protected Expression getExpressionWithoutParenthesis(Expression ex){
    if(ex instanceof Parenthesis){
      Expression child = ((Parenthesis)ex).getExpression();
      return getExpressionWithoutParenthesis(child);
    }else{
      return ex;
    }
   
View Full Code Here

      JSONArray sublist = new JSONArray();//{colname:{operate:1,value:xxxx}}
      JSONObject subQuery=new JSONObject();
      subQuery.put("subQuery", "1");
      subQuery.put("filter", "AND");
      subQuery.put("list", sublist);
      Expression exp = getExpressionWithoutParenthesis(ex);
      linkList.put(subQuery);
      generateList(exp,sublist,subQuery);
     
    }else{
      JSONObject item=new JSONObject();//
View Full Code Here

    if(split.length>1)
    {
      String where=split[1].trim();
      CCJSqlParserManager pm = new CCJSqlParserManager();
      PlainSelect plainSelect =  (PlainSelect)((Select) pm.parse(new StringReader("select * from abc where "+where))).getSelectBody();
      Expression e  = getExpressionWithoutParenthesis(plainSelect.getWhere());
      JSONArray jsonObj = new JSONArray();//{colname:{operate:1,value:xxxx}}

      JSONObject subQuery=new JSONObject();
      subQuery.put("subQuery", "1");
      subQuery.put("filter", "AND");
View Full Code Here

    public void visit(ExpressionList expressionList) {
      if (useBracketsInExprList)
        buffer.append("(");
        for (Iterator iter = expressionList.getExpressions().iterator(); iter.hasNext();) {
            Expression expression = (Expression) iter.next();
            expression.accept(this);
            if (iter.hasNext())
                buffer.append(", ");
        }
      if (useBracketsInExprList)
        buffer.append(")");
View Full Code Here

        buffer.append("{t '" + timeValue.getValue().toString() + "'}");
    }

  public void visit(CaseExpression caseExpression) {
    buffer.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(" END");
  }
View Full Code Here

    }

    if (plainSelect.getGroupByColumnReferences() != null) {
      buffer.append(" GROUP BY ");
      for (Iterator iter = plainSelect.getGroupByColumnReferences().iterator(); iter.hasNext();) {
        Expression columnReference = (Expression) iter.next();
        columnReference.accept(expressionVisitor);
        if (iter.hasNext()) {
          buffer.append(", ");
        }
      }
    }
View Full Code Here

    buffer.append("UPDATE " + update.getTable().getWholeTableName() + " SET ");
    for (int i = 0; i < update.getColumns().size(); i++) {
      Column column = (Column) update.getColumns().get(i);
      buffer.append(column.getWholeColumnName() + "=");

      Expression expression = (Expression) update.getExpressions().get(i);
      expression.accept(expressionVisitor);
      if (i < update.getColumns().size() - 1) {
        buffer.append(", ");
      }

    }
View Full Code Here

  }

  public void visit(ExpressionList expressionList) {
    buffer.append(" VALUES (");
    for (Iterator iter = expressionList.getExpressions().iterator(); iter.hasNext();) {
      Expression expression = (Expression) iter.next();
      expression.accept(expressionVisitor);
      if (iter.hasNext())
        buffer.append(", ");
    }
    buffer.append(")");
  }
View Full Code Here

TOP

Related Classes of net.sf.jsqlparser.expression.Expression

Copyright © 2018 www.massapicom. 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.