Package org.teiid.language

Examples of org.teiid.language.SetQuery


    @Override
    public List<?> translateCommand(Command command, ExecutionContext context) {
      if (!(command instanceof SetQuery)) {
        return null;
      }
      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$
    parts.addAll(translateLimit(limit, context));
    parts.add(" * FROM ("); //$NON-NLS-1$
    parts.add(queryCommand);
View Full Code Here


       
        Select secondQuery = new Select(symbols2, false, items2, null, null, null, null);
       
        Select query = new Select(symbols, false, items, null, null, null, null);
       
        SetQuery setQuery = new SetQuery();
        setQuery.setOperation(SetQuery.Operation.UNION);
        setQuery.setAll(true);
        setQuery.setLeftQuery(query);
        setQuery.setRightQuery(secondQuery);
       
        return setQuery;
    }
View Full Code Here

       
        return setQuery;
    }
   
    public static SetQuery example3() throws Exception {
        SetQuery union = example2();
       
        List<SortSpecification> items = new ArrayList<SortSpecification>();
        items.add(new SortSpecification(Ordering.ASC, new ColumnReference(null, "nugent", null, DataTypeManager.DefaultDataClasses.STRING))); //$NON-NLS-1$
        OrderBy orderBy = new OrderBy(items);
       
        union.setOrderBy(orderBy);
        return union;
    }
View Full Code Here

    }
   
    public void testNestedSetQuery() throws Exception {
        org.teiid.query.sql.lang.SetQuery query = new org.teiid.query.sql.lang.SetQuery(org.teiid.query.sql.lang.SetQuery.Operation.EXCEPT, true, helpExampleSetQuery(), helpExampleSetQuery());
       
        SetQuery setQuery = TstLanguageBridgeFactory.factory.translate(query);
        assertTrue(setQuery.getLeftQuery() instanceof SetQuery);
        assertTrue(setQuery.getRightQuery() instanceof SetQuery);
    }
View Full Code Here

TOP

Related Classes of org.teiid.language.SetQuery

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.