Package org.teiid.query.sql.symbol

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


        Iterator iter = symbols.iterator();
        while (iter.hasNext()) {
            SingleElementSymbol symbol = (SingleElementSymbol)iter.next();
            String name = symbol.getName();
            if (symbol instanceof AliasSymbol) {
                AliasSymbol alias = (AliasSymbol)symbol;
                symbol = alias.getSymbol();
            }
            if (symbol instanceof ElementSymbol) {
                ElementSymbol element = (ElementSymbol)symbol;
                GroupSymbol group = element.getGroupSymbol();
                Object groupID = null;
View Full Code Here


  public static final Select sample2() {
      Select select = new Select();
      select.addSymbol(new ElementSymbol("a"));   //$NON-NLS-1$
      select.addSymbol(new ElementSymbol("b"));   //$NON-NLS-1$
      select.addSymbol(new ElementSymbol("c")); //$NON-NLS-1$
      select.addSymbol(new AliasSymbol("Z", new ElementSymbol("ZZ 9 Plural Z Alpha"))); //$NON-NLS-1$ //$NON-NLS-2$
      return select; 
  }
View Full Code Here


public class TestAliasSymbol extends TestCase {

    public void testAliasEquals() {
        AliasSymbol a1 = new AliasSymbol("X", new ExpressionSymbol("x", new Constant(1))); //$NON-NLS-1$ //$NON-NLS-2$
        AliasSymbol a2 = new AliasSymbol("X", new ExpressionSymbol("x", new Constant(2))); //$NON-NLS-1$ //$NON-NLS-2$
        AliasSymbol a3 = new AliasSymbol("x", new ExpressionSymbol("x", new Constant(1))); //$NON-NLS-1$ //$NON-NLS-2$
       
        assertEquals(a1, a3); //just a different case for the alias
       
        assertFalse(a1.equals(a2)); //different express
    }
View Full Code Here

       
        assertFalse(a1.equals(a2)); //different express
    }
   
    public void testClone() {
        AliasSymbol a1 = new AliasSymbol("X", new ExpressionSymbol("x", new Constant(1))); //$NON-NLS-1$ //$NON-NLS-2$
        a1.setOutputName("foo"); //$NON-NLS-1$
        AliasSymbol clone = (AliasSymbol)a1.clone();
        assertEquals(a1, clone);
        assertEquals(a1.getOutputName(), clone.getOutputName());
    }
View Full Code Here

    } else {
        replacmentSymbol = new ExpressionSymbol(ses.getShortName(), replacement);
    }
   
    if (alias && createAliases() && !replacmentSymbol.getShortCanonicalName().equals(ses.getShortCanonicalName())) {
        replacmentSymbol = new AliasSymbol(ses.getShortName(), replacmentSymbol);
    }
    return replacmentSymbol;
  }
View Full Code Here

   
  public void testVisitOrderBy() {
      OrderBy ob = new OrderBy();
      ob.addVariable(exampleElement(true, 0));
      ob.addVariable(exampleElement(true, 1));
      ob.addVariable(new AliasSymbol("abc", exampleElement(true, 2))); //$NON-NLS-1$
      helpTest(ob, getSymbolMap());     
  }
View Full Code Here

    update.setCriteria(new CompareCriteria(exampleElement(true, 2), CompareCriteria.LT, new Constant("xyz"))); //$NON-NLS-1$
    helpTest(update, getSymbolMap());
  }

  public void testVisitAliasSymbol() {
    AliasSymbol as = new AliasSymbol("abc", exampleElement(true, 0)); //$NON-NLS-1$
    helpTest(as, getSymbolMap());
  }
View Full Code Here

  }

  public void testOrderBy2() {
    OrderBy ob = new OrderBy();
    ob.addVariable(new ElementSymbol("e1")); //$NON-NLS-1$
    ob.addVariable(new AliasSymbol("x", new ElementSymbol("e2"))); //$NON-NLS-1$ //$NON-NLS-2$
   
    helpTest(ob, "ORDER BY e1, x");     //$NON-NLS-1$
  }
View Full Code Here

    AggregateSymbol agg = new AggregateSymbol("abc", NonReserved.MAX, false, new Constant("abc")); //$NON-NLS-1$ //$NON-NLS-2$
    helpTest(agg, "MAX('abc')"); //$NON-NLS-1$
  }
 
  public void testAliasSymbol1() {
      AliasSymbol as = new AliasSymbol("x", new ElementSymbol("y")); //$NON-NLS-1$ //$NON-NLS-2$
      helpTest(as, "y AS x"); //$NON-NLS-1$
  }
View Full Code Here

      helpTest(as, "y AS x"); //$NON-NLS-1$
  }

  // Test alias symbol with reserved word
  public void testAliasSymbol2() {
      AliasSymbol as = new AliasSymbol("select", new ElementSymbol("y")); //$NON-NLS-1$ //$NON-NLS-2$
      helpTest(as, "y AS \"select\""); //$NON-NLS-1$
  }
View Full Code Here

TOP

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

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.