use of org.teiid.query.sql.lang.Query in project teiid by teiid.
the class DependentAccessNode method prepareNextCommand.
/**
* @see org.teiid.query.processor.relational.AccessNode#prepareNextCommand(org.teiid.query.sql.lang.Command)
*/
protected boolean prepareNextCommand(Command atomicCommand) throws TeiidComponentException, TeiidProcessingException {
Assertion.assertTrue(atomicCommand instanceof Query);
Query query = (Query) atomicCommand;
try {
if (this.criteriaProcessor == null) {
this.criteriaProcessor = new DependentCriteriaProcessor(this.maxSetSize, this.maxPredicates, this, query.getCriteria());
this.criteriaProcessor.setPushdown(pushdown);
this.criteriaProcessor.setUseBindings(useBindings);
this.criteriaProcessor.setComplexQuery(complexQuery);
}
if (this.dependentCrit == null) {
dependentCrit = criteriaProcessor.prepareCriteria();
}
query.setCriteria(dependentCrit);
} catch (BlockedException be) {
// $NON-NLS-1$
throw new AssertionError("Should not block prior to declining the sort");
// TODO: the logic could proactively decline the sort rather than throwing an exception
}
// walk up the tree and notify the parent join it is responsible for the sort
if (sort && query.getOrderBy() != null && criteriaProcessor.hasNextCommand()) {
declineSort();
}
if (!sort) {
query.setOrderBy(null);
}
boolean result = RelationalNodeUtil.shouldExecute(atomicCommand, true);
dependentCrit = null;
criteriaProcessor.consumedCriteria();
return result;
}
use of org.teiid.query.sql.lang.Query in project teiid by teiid.
the class TestSubqueryFromClause method example1.
// ################################## HELPERS ################################
public static SubqueryFromClause example1() {
Query query = new Query();
Select select = new Select();
// $NON-NLS-1$
select.addSymbol(new ElementSymbol("a"));
// $NON-NLS-1$
select.addSymbol(new ElementSymbol("b"));
query.setSelect(select);
From from = new From();
// $NON-NLS-1$
from.addGroup(new GroupSymbol("m.g"));
query.setFrom(from);
CompareCriteria crit = new CompareCriteria();
// $NON-NLS-1$
crit.setLeftExpression(new ElementSymbol("a"));
crit.setRightExpression(new Constant(new Integer(5)));
crit.setOperator(CompareCriteria.EQ);
query.setCriteria(crit);
// $NON-NLS-1$
return new SubqueryFromClause("temp", query);
}
use of org.teiid.query.sql.lang.Query in project teiid by teiid.
the class TestSubquerySetCriteria method example1.
public static SubquerySetCriteria example1() {
Query query = new Query();
Select select = new Select();
// $NON-NLS-1$
select.addSymbol(new ElementSymbol("a"));
// $NON-NLS-1$
select.addSymbol(new ElementSymbol("b"));
query.setSelect(select);
From from = new From();
// $NON-NLS-1$
from.addGroup(new GroupSymbol("m.g"));
query.setFrom(from);
CompareCriteria crit = new CompareCriteria();
// $NON-NLS-1$
crit.setLeftExpression(new ElementSymbol("a"));
crit.setRightExpression(new Constant(new Integer(5)));
crit.setOperator(CompareCriteria.EQ);
query.setCriteria(crit);
// $NON-NLS-1$
return new SubquerySetCriteria(new ElementSymbol("temp"), query);
}
use of org.teiid.query.sql.lang.Query in project teiid by teiid.
the class TestSubquerySetCriteria method example3.
public static SubquerySetCriteria example3() {
Query query = new Query();
Select select = new Select();
// $NON-NLS-1$
select.addSymbol(new ElementSymbol("a"));
// $NON-NLS-1$
select.addSymbol(new ElementSymbol("b"));
query.setSelect(select);
From from = new From();
// $NON-NLS-1$
from.addGroup(new GroupSymbol("m.g"));
query.setFrom(from);
CompareCriteria crit = new CompareCriteria();
// $NON-NLS-1$
crit.setLeftExpression(new ElementSymbol("a"));
crit.setRightExpression(new Constant(new Integer(5)));
crit.setOperator(CompareCriteria.EQ);
query.setCriteria(crit);
// $NON-NLS-1$
return new SubquerySetCriteria(new ElementSymbol("temp2"), query);
}
use of org.teiid.query.sql.lang.Query in project teiid by teiid.
the class TestLoopStatement method query1.
// ################################## TEST HELPERS ################################
public static final Query query1() {
Query q1 = new Query();
Select select = new Select();
// $NON-NLS-1$
select.addSymbol(new ElementSymbol("x"));
q1.setSelect(select);
From from = new From();
// $NON-NLS-1$
from.addGroup(new GroupSymbol("g"));
q1.setFrom(from);
return q1;
}
Aggregations