use of org.teiid.query.sql.lang.CompareCriteria 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.CompareCriteria 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.CompareCriteria 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.CompareCriteria in project teiid by teiid.
the class TestSearchedCaseExpression method helpTestWhenCriteria.
public static void helpTestWhenCriteria(SearchedCaseExpression caseExpr, int expectedWhens) {
assertEquals(expectedWhens, caseExpr.getWhenCount());
// $NON-NLS-1$
ElementSymbol x = new ElementSymbol("x");
for (int i = 0; i < expectedWhens; i++) {
assertEquals(new CompareCriteria(x, CompareCriteria.EQ, new Constant(new Integer(i))), caseExpr.getWhenCriteria(i));
}
}
use of org.teiid.query.sql.lang.CompareCriteria in project teiid by teiid.
the class TestSearchedCaseExpression method getAlphaWhenCriteria.
public static List getAlphaWhenCriteria(int criteria) {
ArrayList list = new ArrayList();
// $NON-NLS-1$
ElementSymbol x = new ElementSymbol("x");
for (int i = 0; i < criteria; i++) {
list.add(new CompareCriteria(x, CompareCriteria.EQ, new Constant(String.valueOf((char) ('a' + i)))));
}
return list;
}
Aggregations