Package org.teiid.language

Examples of org.teiid.language.Limit


        if(orderBy != null) {
            buffer.append(Tokens.SPACE);
            append(orderBy);
        }

        Limit limit = obj.getLimit();
        if(limit != null) {
            buffer.append(Tokens.SPACE);
            append(limit);
        }
    }
View Full Code Here


      }
      SetQuery queryCommand = (SetQuery)command;
    if (queryCommand.getLimit() == null) {
      return null;
      }
    Limit limit = queryCommand.getLimit();
    OrderBy orderBy = queryCommand.getOrderBy();
    queryCommand.setLimit(null);
    queryCommand.setOrderBy(null);
    List<Object> parts = new ArrayList<Object>(6);
    parts.add("SELECT "); //$NON-NLS-1$
View Full Code Here

      // class, and we should make our own key class. In practice, this makes things simpler.
      SortKey[] sortKeys = getSortKeysFromOrderByClause(orderBy);
     
      // Parse LIMIT clause.
      // Note that offsets are not supported.
      Limit limit = query.getLimit();
      long countLimit = -1;
      if(limit != null) {
        countLimit = limit.getRowLimit();
      }
     
      // Create Search Details
      LDAPSearchDetails sd = new LDAPSearchDetails(contextName, searchScope, filterBuilder.toString(), attributeList, sortKeys, countLimit, elementList);
      // Search Details logging
View Full Code Here

      }
    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]);
      }
      } else {
          parts.add("*"); //$NON-NLS-1$
      }
    if (limit.getRowOffset() > 0) {
      parts.add(" FROM (SELECT VIEW_FOR_LIMIT.*, ROWNUM ROWNUM_ FROM ("); //$NON-NLS-1$
    } else {
      parts.add(" FROM ("); //$NON-NLS-1$
    }
    parts.add(queryCommand);
    if (limit.getRowOffset() > 0) {
      parts.add(") VIEW_FOR_LIMIT WHERE ROWNUM <= "); //$NON-NLS-1$
      parts.add(limit.getRowLimit() + limit.getRowOffset());
      parts.add(") WHERE ROWNUM_ > "); //$NON-NLS-1$
      parts.add(limit.getRowOffset());
    } else {
      parts.add(") WHERE ROWNUM <= "); //$NON-NLS-1$
      parts.add(limit.getRowLimit());
    }
    return parts;
    }
View Full Code Here

TOP

Related Classes of org.teiid.language.Limit

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.