Package org.teiid.query.sql.symbol

Examples of org.teiid.query.sql.symbol.SelectSymbol


    Select select = query.getSelect();
    List elements = select.getSymbols();
    assertEquals("Wrong number of select symbols: ", elementNames.length, elements.size()); //$NON-NLS-1$

    for(int i=0; i<elements.size(); i++) {
      SelectSymbol symbol = (SelectSymbol) elements.get(i);
      assertEquals("Element name does not match: ", elementNames[i].toUpperCase(), symbol.getName().toUpperCase()); //$NON-NLS-1$
    }
  }
View Full Code Here


     * @param select The select clause
     * @since 4.2
     */
    public static void resolveNullLiterals(List symbols) {
        for (int i = 0; i < symbols.size(); i++) {
            SelectSymbol selectSymbol = (SelectSymbol) symbols.get(i);
           
            if (!(selectSymbol instanceof SingleElementSymbol)) {
                continue;
            }
           
View Full Code Here

        }
        beginClause(2);

        Iterator iter = obj.getSymbols().iterator();
        while (iter.hasNext()) {
            SelectSymbol symbol = (SelectSymbol)iter.next();
            visitNode(symbol);
            if (iter.hasNext()) {
                append(", "); //$NON-NLS-1$
            }
        }
View Full Code Here

     * everybody who is not marked "included" as excluded.
     * @param xmlCommand
     */
    static MappingDocument preMarkExcluded(Query xmlCommand, MappingDocument doc) {
        Select select = xmlCommand.getSelect();
        SelectSymbol firstSymbol = select.getSymbol(0);

        // 0. mark the nodes to be excluded
        if(firstSymbol instanceof AllSymbol) {
            return doc;
        }
View Full Code Here

   */
  public List<SingleElementSymbol> getProjectedSymbols() {
    ArrayList<SingleElementSymbol> projectedSymbols = new ArrayList<SingleElementSymbol>();
    Iterator iter = symbols.iterator();
    while(iter.hasNext()) {
      SelectSymbol symbol = (SelectSymbol) iter.next();
      if(symbol instanceof SingleElementSymbol) {
        projectedSymbols.add((SingleElementSymbol)symbol);
      } else {
          List<ElementSymbol> multiSymbols = ((MultipleElementSymbol)symbol).getElementSymbols();
          if(multiSymbols != null) {
View Full Code Here

  public Object clone() {
      List thisSymbols = getSymbols();
      List copySymbols = new ArrayList(thisSymbols.size());
      Iterator iter = thisSymbols.iterator();
      while(iter.hasNext()) {
        SelectSymbol ss = (SelectSymbol) iter.next();
        copySymbols.add(ss.clone());   
      }
           
    Select copy = new Select(copySymbols);
    copy.setDistinct( isDistinct() );
    return copy;
View Full Code Here

    // Allow SELECT DISTINCT, which is ignored.  It is meaningless except for
    // self-entity relation using relate() functionality

    List elements = select.getSymbols();
    for (int i = 0; i < elements.size(); i++) {
      SelectSymbol ss = (SelectSymbol) elements.get(i);

      if (ss instanceof ElementSymbol) {
        // Here we make an assumption that: all elements named with "xml" must use qualified name
        // rather than a simple "xml" in order to distinguish it from "SELECT xml" and
        // "SELECT model.document.xml" case, both of whom stand for selecting the whole document.

        // Then "SELECT xml" or "SELECT model.document.xml" can only stand for one meaning with two cases:
        // 1) whole document
        // 2) whole document, root name = "xml", too

        // There are other cases of "xml", such as, element name = "xml",
        // but those are ok because those will be resolved later as normal elements
        String symbolName = ss.getName();
        if(symbolName.equalsIgnoreCase("xml") || symbolName.equalsIgnoreCase(group.getName() + ".xml")) { //$NON-NLS-1$ //$NON-NLS-2$
          if(elements.size() != 1) {
            throw new QueryResolverException(QueryPlugin.Util.getString("XMLQueryResolver.xml_only_valid_alone")); //$NON-NLS-1$
          }
          select.clearSymbols();
                    AllSymbol all = new AllSymbol();
                    all.setElementSymbols(validElements);
          select.addSymbol(all);
          query.setSelect(select);
          return;
        }
                // normal elements
        resolveElement((ElementSymbol)ss, validElements, externalGroups, metadata);
      } else if (ss instanceof AllInGroupSymbol) {
        // Resolve the element with "*" case. such as "A.*"
        // by stripping off the ".*" part,
        String symbolName = ss.getName();
        int index = symbolName.indexOf("*"); //$NON-NLS-1$
        String elementPart = symbolName.substring(0, index-1);

                // Check for case where we have model.doc.*
                if(elementPart.equalsIgnoreCase(group.getName())) {
View Full Code Here

               
                if(childElements.size() != getElements().size()) {
                    needsProject = true;                   
                } else {
                    for(int i=0; i<selectSymbols.size(); i++) {
                        SelectSymbol symbol = (SelectSymbol) selectSymbols.get(i);
                       
                        if(symbol instanceof AliasSymbol) {
                            Integer index = (Integer) elementMap.get(symbol);
                            if(index != null && index.intValue() == i) {
                                continue;
View Full Code Here

      List projectedTuple = new ArrayList(selectSymbols.size());

      // Walk through symbols
            for(int i=0; i<selectSymbols.size(); i++) {
        SelectSymbol symbol = (SelectSymbol) selectSymbols.get(i);
        updateTuple(symbol, tuple, projectedTuple);
      }

            // Add to batch
            addBatchRow(projectedTuple);
View Full Code Here

TOP

Related Classes of org.teiid.query.sql.symbol.SelectSymbol

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.