Search in sources :

Example 1 with SubquerySetCriteria

use of org.teiid.query.sql.lang.SubquerySetCriteria in project teiid by teiid.

the class TestSubqueryInCriteriaImpl method helpExample.

public static SubquerySetCriteria helpExample() {
    // $NON-NLS-1$ //$NON-NLS-2$
    ElementSymbol element = TestElementImpl.helpExample("g1", "e1");
    Query query = TestQueryImpl.helpExample(true);
    SubquerySetCriteria ssc = new SubquerySetCriteria(element, query);
    ssc.setNegated(true);
    return ssc;
}
Also used : ElementSymbol(org.teiid.query.sql.symbol.ElementSymbol) Query(org.teiid.query.sql.lang.Query) SubquerySetCriteria(org.teiid.query.sql.lang.SubquerySetCriteria)

Example 2 with SubquerySetCriteria

use of org.teiid.query.sql.lang.SubquerySetCriteria 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);
}
Also used : ElementSymbol(org.teiid.query.sql.symbol.ElementSymbol) Query(org.teiid.query.sql.lang.Query) Constant(org.teiid.query.sql.symbol.Constant) Select(org.teiid.query.sql.lang.Select) GroupSymbol(org.teiid.query.sql.symbol.GroupSymbol) From(org.teiid.query.sql.lang.From) SubquerySetCriteria(org.teiid.query.sql.lang.SubquerySetCriteria) CompareCriteria(org.teiid.query.sql.lang.CompareCriteria)

Example 3 with SubquerySetCriteria

use of org.teiid.query.sql.lang.SubquerySetCriteria in project teiid by teiid.

the class TestSubquerySetCriteria method testEquals2.

public void testEquals2() {
    SubquerySetCriteria c1 = example1();
    SubquerySetCriteria c2 = c1.clone();
    // $NON-NLS-1$
    assertTrue("Equivalent set criteria should have been equal.", c1.equals(c2));
}
Also used : SubquerySetCriteria(org.teiid.query.sql.lang.SubquerySetCriteria)

Example 4 with SubquerySetCriteria

use of org.teiid.query.sql.lang.SubquerySetCriteria in project teiid by teiid.

the class TestSubquerySetCriteria method testEquals1.

// ################################## ACTUAL TESTS ################################
public void testEquals1() {
    SubquerySetCriteria c1 = example1();
    SubquerySetCriteria c2 = example1();
    // $NON-NLS-1$
    assertTrue("Equivalent set criteria should have been equal.", c1.equals(c2));
}
Also used : SubquerySetCriteria(org.teiid.query.sql.lang.SubquerySetCriteria)

Example 5 with SubquerySetCriteria

use of org.teiid.query.sql.lang.SubquerySetCriteria 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);
}
Also used : ElementSymbol(org.teiid.query.sql.symbol.ElementSymbol) Query(org.teiid.query.sql.lang.Query) Constant(org.teiid.query.sql.symbol.Constant) Select(org.teiid.query.sql.lang.Select) GroupSymbol(org.teiid.query.sql.symbol.GroupSymbol) From(org.teiid.query.sql.lang.From) SubquerySetCriteria(org.teiid.query.sql.lang.SubquerySetCriteria) CompareCriteria(org.teiid.query.sql.lang.CompareCriteria)

Aggregations

SubquerySetCriteria (org.teiid.query.sql.lang.SubquerySetCriteria)7 Query (org.teiid.query.sql.lang.Query)4 ElementSymbol (org.teiid.query.sql.symbol.ElementSymbol)3 CompareCriteria (org.teiid.query.sql.lang.CompareCriteria)2 From (org.teiid.query.sql.lang.From)2 Select (org.teiid.query.sql.lang.Select)2 Constant (org.teiid.query.sql.symbol.Constant)2 GroupSymbol (org.teiid.query.sql.symbol.GroupSymbol)2 Expression (org.teiid.query.sql.symbol.Expression)1 Function (org.teiid.query.sql.symbol.Function)1