use of org.teiid.query.sql.symbol.Constant in project teiid by teiid.
the class TestSetCriteria method testNonHashableClone.
@Test
public void testNonHashableClone() {
SetCriteria c1 = new SetCriteria();
// $NON-NLS-1$
c1.setExpression(new ElementSymbol("e1"));
TreeSet vals = new TreeSet();
vals.add(new Constant(BigDecimal.valueOf(1.1)));
vals.add(new Constant(BigDecimal.valueOf(1.2)));
c1.setValues(vals);
c1.setAllConstants(true);
SetCriteria c2 = (SetCriteria) c1.clone();
assertTrue(c2.getValues() instanceof TreeSet);
}
use of org.teiid.query.sql.symbol.Constant in project teiid by teiid.
the class TestSetCriteria method sample2.
public static final SetCriteria sample2() {
SetCriteria c1 = new SetCriteria();
// $NON-NLS-1$
c1.setExpression(new ElementSymbol("e2"));
List vals = new ArrayList();
// $NON-NLS-1$
vals.add(new Constant("c"));
// $NON-NLS-1$
vals.add(new Constant("d"));
c1.setValues(vals);
return c1;
}
use of org.teiid.query.sql.symbol.Constant 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.Constant 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.Constant 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);
}
Aggregations