Examples of SetQuery


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

    return partitions;
  }
 
  public static boolean extractQueries(QueryCommand queryCommand, List<Query> result) {
    if (queryCommand instanceof SetQuery) {
      SetQuery sq = (SetQuery)queryCommand;
      if (sq.isAll() && sq.getOperation() == Operation.UNION && sq.getOrderBy() == null && sq.getLimit() == null && sq.getWith() == null) {
        if (!extractQueries(sq.getLeftQuery(), result)) {
          return false;
        }
        if (!extractQueries(sq.getRightQuery(), result)) {
          return false;
        }
        return true;
        }
      return false;
View Full Code Here

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

        From u2f = new From();
        u2f = new From();
        u2f.addClause(new UnaryFromClause(new GroupSymbol("db.g3"))); //$NON-NLS-1$
        u2.setFrom(u2f);

        SetQuery union = new SetQuery(Operation.UNION, true, u1, u2);       
                      
        SubquerySetCriteria subCrit = new SubquerySetCriteria(expr, union);
      
        Query outer = new Query();
        outer.setSelect(select);
View Full Code Here

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

    public void validate(Command command, List<ElementSymbol> viewSymbols) throws QueryMetadataException, TeiidComponentException {
      if (this.updateInfo.deleteType != UpdateType.INHERENT && this.updateInfo.updateType != UpdateType.INHERENT && this.updateInfo.insertType != UpdateType.INHERENT) {
        return;
      }
      if (command instanceof SetQuery) {
        SetQuery setQuery = (SetQuery)command;
          if (setQuery.getLimit() != null) {
            handleValidationError(QueryPlugin.Util.getString("ERR.015.012.0013"), true, true, true); //$NON-NLS-1$
            return;
          }
        LinkedList<Query> queries = new LinkedList<Query>();
        if (!PartitionAnalyzer.extractQueries((SetQuery)command, queries)) {
View Full Code Here

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

                        return false;
                    }
                }
           
                if(queryCommand instanceof SetQuery) {
                    SetQuery union = (SetQuery) queryCommand;
                    boolean shouldExecute = false;
                    for (QueryCommand innerQuery : union.getQueryCommands()) {
                        boolean shouldInner = shouldExecute(innerQuery, simplifyCriteria, duringPlanning);
                        if(shouldInner) {
                          shouldExecute = true;
                            break;                           
                        }                       
View Full Code Here

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

    f2.addGroup(new GroupSymbol("m.g2"));     //$NON-NLS-1$
    Query q2 = new Query();
    q2.setSelect(s2);
    q2.setFrom(f2);
   
    SetQuery sq = new SetQuery(Operation.UNION, false, q1, q2);

    helpTest(sq, "SELECT e1 FROM m.g1 UNION SELECT e1 FROM m.g2"); //$NON-NLS-1$
  }
View Full Code Here

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

    f2.addGroup(new GroupSymbol("m.g2"));     //$NON-NLS-1$
    Query q2 = new Query();
    q2.setSelect(s2);
    q2.setFrom(f2);
   
    SetQuery sq = new SetQuery(Operation.UNION, true, q1, q2);

    helpTest(sq, "SELECT e1 FROM m.g1 UNION ALL SELECT e1 FROM m.g2"); //$NON-NLS-1$
  }
View Full Code Here

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

    q2.setFrom(f2);
   
    OrderBy orderBy = new OrderBy();
    orderBy.addVariable(new ElementSymbol("e1")); //$NON-NLS-1$
   
    SetQuery sq = new SetQuery(Operation.UNION, false, q1, q2);
    sq.setOrderBy(orderBy);

    helpTest(sq, "SELECT e1 FROM m.g1 UNION SELECT e1 FROM m.g2 ORDER BY e1"); //$NON-NLS-1$
  }
View Full Code Here

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

    f2.addGroup(new GroupSymbol("m.g2"));     //$NON-NLS-1$
    Query q2 = new Query();
    q2.setSelect(s2);
    q2.setFrom(f2);
   
    SetQuery sq = new SetQuery(Operation.UNION, false, q1, q2);

    helpTest(sq, "SELECT e1 FROM m.g1 UNION SELECT e1 FROM m.g2"); //$NON-NLS-1$
  }
View Full Code Here

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

    f3.addGroup(new GroupSymbol("m.g3"));     //$NON-NLS-1$
    Query q3 = new Query();
    q3.setSelect(s3);
    q3.setFrom(f3);
   
    SetQuery sq = new SetQuery(Operation.UNION, false, q1, q2);

    SetQuery sq2 = new SetQuery(Operation.UNION, true, q3, sq);

    helpTest(sq2, "SELECT e3 FROM m.g3 UNION ALL (SELECT e1 FROM m.g1 UNION SELECT e1 FROM m.g2)"); //$NON-NLS-1$
  }
View Full Code Here

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

        Select s2 = new Select();
        s2.addSymbol(new AliasSymbol("FOO", new ExpressionSymbol("xxx", new Constant("B")))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        Query q2 = new Query();
        q2.setSelect(s2);
       
        SetQuery sq = new SetQuery(Operation.UNION, false, q1, q2);

        helpTest(sq, expected);       
    }
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.