use of org.teiid.query.sql.symbol.GroupSymbol in project teiid by teiid.
the class TestSetQuery method sample1.
// ################################## TEST HELPERS ################################
/**
* SELECT x FROM g UNION ALL SELECT y FROM h
*/
public static final SetQuery sample1() {
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);
Query q2 = new Query();
select = new Select();
// $NON-NLS-1$
select.addSymbol(new ElementSymbol("y"));
q2.setSelect(select);
from = new From();
// $NON-NLS-1$
from.addGroup(new GroupSymbol("h"));
q2.setFrom(from);
SetQuery sq = new SetQuery(Operation.UNION);
sq.setLeftQuery(q1);
sq.setRightQuery(q2);
return sq;
}
use of org.teiid.query.sql.symbol.GroupSymbol 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.symbol.GroupSymbol 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.symbol.GroupSymbol 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.symbol.GroupSymbol 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