Package net.sf.jsqlparser.statement.select

Examples of net.sf.jsqlparser.statement.select.PlainSelect


  }

  @Override
  public void visit(Union union) {
    for (final Iterator iter = union.getPlainSelects().iterator(); iter.hasNext();) {
      final PlainSelect plainSelect = (PlainSelect) iter.next();
      visit(plainSelect);
    }
  }
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(Union union) {
    for (Iterator iter = union.getPlainSelects().iterator(); iter.hasNext();) {
      buffer.append("(");
      PlainSelect plainSelect = (PlainSelect) iter.next();
      plainSelect.accept(this);
      buffer.append(")");
      if (iter.hasNext()) {
        buffer.append(" UNION ");
      }
View Full Code Here

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

  final public PlainSelect PlainSelect() throws ParseException {
        PlainSelect plainSelect = new PlainSelect();
        List selectItems = null;
        FromItem fromItem = null;
        List joins = null;
        List distinctOn = null;
        Expression where = null;
        List orderByElements;
        List groupByColumnReferences = null;
        Expression having = null;
        Limit limit = null;
        Top top = null;
    jj_consume_token(K_SELECT);
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case K_ALL:
    case K_DISTINCT:
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case K_ALL:
        jj_consume_token(K_ALL);
        break;
      case K_DISTINCT:
        jj_consume_token(K_DISTINCT);
                                       Distinct distinct = new Distinct(); plainSelect.setDistinct(distinct);
        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
        case K_ON:
          jj_consume_token(K_ON);
          jj_consume_token(79);
          distinctOn = SelectItemsList();
                                                                           plainSelect.getDistinct().setOnSelectItems(distinctOn);
          jj_consume_token(80);
          break;
        default:
          jj_la1[24] = jj_gen;
          ;
        }
        break;
      default:
        jj_la1[25] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
      break;
    default:
      jj_la1[26] = jj_gen;
      ;
    }
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case K_TOP:
      top = Top();
                      plainSelect.setTop(top);
      break;
    default:
      jj_la1[27] = jj_gen;
      ;
    }
    selectItems = SelectItemsList();
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case K_INTO:
      IntoClause();
      break;
    default:
      jj_la1[28] = jj_gen;
      ;
    }
    jj_consume_token(K_FROM);
    fromItem = FromItem();
    joins = JoinsList();
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case K_WHERE:
      where = WhereClause();
                            plainSelect.setWhere(where);
      break;
    default:
      jj_la1[29] = jj_gen;
      ;
    }
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case K_GROUP:
      groupByColumnReferences = GroupByColumnReferences();
                                                          plainSelect.setGroupByColumnReferences(groupByColumnReferences);
      break;
    default:
      jj_la1[30] = jj_gen;
      ;
    }
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case K_HAVING:
      having = Having();
                        plainSelect.setHaving(having);
      break;
    default:
      jj_la1[31] = jj_gen;
      ;
    }
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case K_ORDER:
      orderByElements = OrderByElements();
                                                                         plainSelect.setOrderByElements(orderByElements);
      break;
    default:
      jj_la1[32] = jj_gen;
      ;
    }
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case K_LIMIT:
    case K_OFFSET:
      limit = Limit();
                          plainSelect.setLimit(limit);
      break;
    default:
      jj_la1[33] = jj_gen;
      ;
    }
                plainSelect.setSelectItems(selectItems);
                plainSelect.setFromItem(fromItem);
                if (joins.size() > 0)
                        plainSelect.setJoins(joins);
                {if (true) return plainSelect;}
    throw new Error("Missing return statement in function");
  }
View Full Code Here

  final public Union Union() throws ParseException {
        Union union = new Union();
        List orderByElements = null;
        Limit limit = null;
        PlainSelect select = null;
        ArrayList selects = new ArrayList();
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case 79:
      jj_consume_token(79);
      select = PlainSelect();
View Full Code Here

    return buildSelectFromTableAndSelectItems(table, list);
  }
 
  public static Select buildSelectFromTableAndSelectItems(Table table, SelectItem ... selectItems) {
    Select select = new Select();
    PlainSelect body = new PlainSelect();
    body.addSelectItems(selectItems);
    body.setFromItem(table);
    select.setSelectBody(body);
    return select;
  }
View Full Code Here

   * @param onExpression
   * @return
   */
  public static Join addJoin(Select select, final Table table, final Expression onExpression) {
    if (select.getSelectBody() instanceof PlainSelect) {
      PlainSelect plainSelect = (PlainSelect) select.getSelectBody();
      List<Join> joins = plainSelect.getJoins();
      if (joins == null) {
        joins = new ArrayList<Join>();
        plainSelect.setJoins(joins);
      }
      Join join = new Join();
      join.setRightItem(table);
      join.setOnExpression(onExpression);
      joins.add(join);
View Full Code Here

        final int count;
        try {
            final SimpleFeatureType fullSchema = typeInfo.getFeatureType();
            if (typeInfo.isInProcessView()) {
                final SeQueryInfo definitionQuery = typeInfo.getSdeDefinitionQuery();
                final PlainSelect viewSelectStatement = typeInfo.getDefinitionQuery();
                countQuery = createInprocessViewQuery(session, fullSchema, query, definitionQuery,
                        viewSelectStatement);
            } else {
                final FIDReader fidStrategy = typeInfo.getFidStrategy();
                countQuery = createQuery(session, fullSchema, query, fidStrategy, versioningHandler);
View Full Code Here

        final ArcSDEQuery boundsQuery;

        if (typeInfo.isInProcessView()) {
            final SeQueryInfo definitionQuery = typeInfo.getSdeDefinitionQuery();
            final PlainSelect viewSelectStatement = typeInfo.getDefinitionQuery();
            boundsQuery = createInprocessViewQuery(session, fullSchema, realQuery, definitionQuery,
                    viewSelectStatement);
        } else {
            final FIDReader fidStrategy = typeInfo.getFidStrategy();
            boundsQuery = createQuery(session, fullSchema, realQuery, fidStrategy,
View Full Code Here

        return qualifiedSelect;
    }

    public void visit(PlainSelect plainSelect) throws IllegalStateException {
        qualifiedSelect = new PlainSelect();

        @SuppressWarnings("unchecked")
        List<FromItem> fromItems = qualifyFromItems(plainSelect.getFromItems());
        qualifiedSelect.setFromItems(fromItems);
View Full Code Here

TOP

Related Classes of net.sf.jsqlparser.statement.select.PlainSelect

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.