Examples of SetQuery


Examples of org.jboss.dna.graph.query.model.SetQuery

        QueryCommand result = new Query(source, constraint, orderings, columns, limit, distinct);
        if (this.firstQuery != null) {
            // EXCEPT has a higher precedence than INTERSECT or UNION, so if the first query is
            // an INTERSECT or UNION SetQuery, the result should be applied to the RHS of the previous set ...
            if (firstQuery instanceof SetQuery && firstQuerySetOperation == Operation.EXCEPT) {
                SetQuery setQuery = (SetQuery)firstQuery;
                QueryCommand left = setQuery.getLeft();
                QueryCommand right = setQuery.getRight();
                SetQuery exceptQuery = new SetQuery(right, Operation.EXCEPT, result, firstQueryAll);
                result = new SetQuery(left, setQuery.getOperation(), exceptQuery, setQuery.isAll());
            } else {
                result = new SetQuery(this.firstQuery, this.firstQuerySetOperation, result, this.firstQueryAll);
            }
        }
        return result;
    }
View Full Code Here

Examples of org.jboss.dna.graph.query.model.SetQuery

            operation = Operation.EXCEPT;
        }
        boolean all = tokens.canConsume("ALL");
        // Parse the next select
        QueryCommand rightQuery = parseQuery(tokens, typeSystem);
        return new SetQuery(leftHandSide, operation, rightQuery, all);
    }
View Full Code Here

Examples of org.modeshape.jcr.query.model.SetQuery

        if (command instanceof SelectQuery) {
            SelectQuery query = (SelectQuery)command;
            return new QueryObjectModel(context, expression, language, query, hints, storedAtPath);
        }
        if (command instanceof SetQuery) {
            SetQuery query = (SetQuery)command;
            return new SetQueryObjectModel(this.context, expression, language, query, hints, storedAtPath);
        }
        JcrQueryContext context = new SessionQueryContext(session);
        return new JcrQuery(context, expression, language, command, hints, storedAtPath);
    }
View Full Code Here

Examples of org.modeshape.jcr.query.model.SetQuery

        QueryCommand result = new Query(source, constraint, orderings, columns, limit, distinct);
        if (this.firstQuery != null) {
            // EXCEPT has a higher precedence than INTERSECT or UNION, so if the first query is
            // an INTERSECT or UNION SetQuery, the result should be applied to the RHS of the previous set ...
            if (firstQuery instanceof SetQuery && firstQuerySetOperation == Operation.EXCEPT) {
                SetQuery setQuery = (SetQuery)firstQuery;
                QueryCommand left = setQuery.getLeft();
                QueryCommand right = setQuery.getRight();
                SetQuery exceptQuery = new SetQuery(right, Operation.EXCEPT, result, firstQueryAll);
                result = new SetQuery(left, setQuery.operation(), exceptQuery, setQuery.isAll());
            } else {
                result = new SetQuery(this.firstQuery, this.firstQuerySetOperation, result, this.firstQueryAll);
            }
        }
        return result;
    }
View Full Code Here

Examples of org.modeshape.jcr.query.model.SetQuery

    protected SetQuery setQuery( QueryCommand leftQuery,
                                 Operation operation,
                                 QueryCommand rightQuery,
                                 boolean all ) {
        return new SetQuery(leftQuery, operation, rightQuery, all);
    }
View Full Code Here

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

Examples of org.teiid.language.SetQuery

       
        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

Examples of org.teiid.language.SetQuery

       
        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

Examples of org.teiid.language.SetQuery

    }
   
    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

Examples of org.teiid.query.sql.lang.SetQuery

        if (command instanceof Update) {
          Update query = (Update) command;
            return query.getCriteria() == null;
        }
        if (command instanceof SetQuery) {
          SetQuery query = (SetQuery)command;
          return hasNoCriteria(query.getLeftQuery()) || hasNoCriteria(query.getRightQuery());
        }
        return false;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.