Package net.sf.jsqlparser.statement.select

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


        Function function = null;
        AllColumns allTableColumns = null;
        Column tableColumn = null;
        String alias = null;
        SelectItem selectItem = null;
        SelectExpressionItem selectExpressionItem = null;
        Expression expression = null;
        SubSelect subSelect = null;
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case 82:
      jj_consume_token(82);
           selectItem = new AllColumns();
      break;
    default:
      jj_la1[51] = jj_gen;
      if (jj_2_6(2147483647)) {
        selectItem = AllTableColumns();
      } else {
        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
        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:
          expression = SimpleExpression();
                                         selectExpressionItem = new SelectExpressionItem(); selectExpressionItem.setExpression(expression);
          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
          case K_AS:
          case S_IDENTIFIER:
          case S_QUOTED_IDENTIFIER:
            alias = Alias();
                                          selectExpressionItem.setAlias(alias);
            break;
          default:
            jj_la1[50] = jj_gen;
            ;
          }
View Full Code Here


   * @return
   */
  public static Select buildSelectFromTableAndExpressions(Table table, Expression ... expr) {
    SelectItem[] list = new SelectItem[expr.length];
    for (int i=0;i<expr.length;i++) {
      list[i]=new SelectExpressionItem(expr[i]);
    }
    return buildSelectFromTableAndSelectItems(table, list);
  }
View Full Code Here

   * @throws net.sf.jsqlparser.JSQLParserException
   */
  public static Select buildSelectFromTableAndExpressions(Table table, String ... expr) throws JSQLParserException {
    SelectItem[] list = new SelectItem[expr.length];
    for (int i=0;i<expr.length;i++) {
      list[i]=new SelectExpressionItem(CCJSqlParserUtil.parseExpression(expr[i]));
    }
    return buildSelectFromTableAndSelectItems(table, list);
  }
View Full Code Here

  public static void addExpression(Select select, final Expression expr) {
    select.getSelectBody().accept(new SelectVisitor() {

      @Override
      public void visit(PlainSelect plainSelect) {
        plainSelect.getSelectItems().add(new SelectExpressionItem(expr));
      }

      @Override
      public void visit(SetOperationList setOpList) {
        throw new UnsupportedOperationException("Not supported yet.");
View Full Code Here

            Column column = new Column();
            column.setTable(qt);
            column.setColumnName(colName);

            SelectExpressionItem item = new SelectExpressionItem();
            item.setExpression(column);

            qualifiedItems.add(item);
        }
    }
View Full Code Here

        }
    }

    public void visit(SelectExpressionItem selectExpressionItem) {

        SelectExpressionItem qualifiedItem = new SelectExpressionItem();

        qualifiedItem.setAlias(selectExpressionItem.getAlias());

        Expression selectExpression = selectExpressionItem.getExpression();

        Expression qualifiedExpression = ExpressionQualifier.qualify(session, tableAliases,
                selectExpression);

        qualifiedItem.setExpression(qualifiedExpression);

        this.qualifiedItems = Collections.singletonList(qualifiedItem);
    }
View Full Code Here

                            + " AllColumns and AllTableColumns instances should be resolved to their list "
                            + " of column names at view registration time.";
                    LOGGER.severe(msg);
                    throw new IllegalStateException(msg);
                }
                SelectExpressionItem colDef = (SelectExpressionItem) item;
                String alias = colDef.getAlias();
                if (alias == null) {
                    if (!(colDef.getExpression() instanceof Column)) {
                        throw new RuntimeException(
                                "if select item is not a plain column an alias should be provided: "
                                        + colDef);
                    }
                    Column column = (Column) colDef.getExpression();
                    alias = column.getColumnName();
                }

                attributeNames.put(alias, colDef);
            }
View Full Code Here

     */
    public String getColumnDefinition(final String alias) {
        final String encodedColumnDefinition;
        if (this.definitionQuery != null) {
            // its an inprocess view
            SelectExpressionItem colDef = (SelectExpressionItem) attributeNames.get(alias);
            // String alias = colDef.getAlias();
            String sqlExpression = String.valueOf(colDef);

            // encodedColumnDefinition = sqlExpression + " AS " + alias;
            encodedColumnDefinition = sqlExpression;
View Full Code Here

TOP

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

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.