Package org.teiid.language

Examples of org.teiid.language.QueryExpression


        }
             
        this.rowsNeeded = this.config.getRowCount();
       
        if (command instanceof QueryExpression) {
            QueryExpression queryCommand = (QueryExpression)command;
            if (queryCommand.getLimit() != null) {
              this.rowsNeeded = queryCommand.getLimit().getRowLimit();
            }
        }
       
        // Prepare for execution
        List types = determineOutputTypes(this.command);
View Full Code Here


    }

    private List determineOutputTypes(Command command) {           
        // Get select columns and lookup the types in metadata
        if(command instanceof QueryExpression) {
            QueryExpression query = (QueryExpression) command;
            return Arrays.asList(query.getColumnTypes());
        }
        if (command instanceof Call) {
          return Arrays.asList(((Call)command).getResultSetColumnTypes());
        }
        List<Class<?>> types = new ArrayList<Class<?>>(1);
View Full Code Here

      }
     
      if (!(command instanceof QueryExpression)) {
        return null;
      }
    QueryExpression queryCommand = (QueryExpression)command;
    if (queryCommand.getLimit() == null) {
      return null;
      }
    Limit limit = queryCommand.getLimit();
    queryCommand.setLimit(null);
      List<Object> parts = new ArrayList<Object>();
      parts.add("SELECT "); //$NON-NLS-1$
      /*
       * if all of the columns are aliased, assume that names matter - it actually only seems to matter for
       * the first query of a set op when there is a order by.  Rather than adding logic to traverse up,
       * we just use the projected names
       */
      boolean allAliased = true;
      for (DerivedColumn selectSymbol : queryCommand.getProjectedQuery().getDerivedColumns()) {
      if (selectSymbol.getAlias() == null) {
        allAliased = false;
        break;
      }
    }
      if (allAliased) {
        String[] columnNames = queryCommand.getColumnNames();
        for (int i = 0; i < columnNames.length; i++) {
          if (i > 0) {
            parts.add(", "); //$NON-NLS-1$
          }
          parts.add(columnNames[i]);
View Full Code Here

TOP

Related Classes of org.teiid.language.QueryExpression

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.