use of org.teiid.query.sql.lang.UnaryFromClause in project teiid by teiid.
the class TestQueryImpl method helpExampleFrom.
public static org.teiid.query.sql.lang.From helpExampleFrom() {
List<UnaryFromClause> clauses = new ArrayList<UnaryFromClause>();
// $NON-NLS-1$
clauses.add(new UnaryFromClause(TestGroupImpl.helpExample("vm1.g1")));
// $NON-NLS-1$ //$NON-NLS-2$
clauses.add(new UnaryFromClause(TestGroupImpl.helpExample("myAlias", "vm1.g2")));
// $NON-NLS-1$
clauses.add(new UnaryFromClause(TestGroupImpl.helpExample("vm1.g3")));
// $NON-NLS-1$
clauses.add(new UnaryFromClause(TestGroupImpl.helpExample("vm1.g4")));
return new org.teiid.query.sql.lang.From(clauses);
}
use of org.teiid.query.sql.lang.UnaryFromClause in project teiid by teiid.
the class TestLimitParsing method testSetQueryLimit.
@Test
public void testSetQueryLimit() {
Query query = new Query();
Select select = new Select(Arrays.asList(new MultipleElementSymbol()));
// $NON-NLS-1$
From from = new From(Arrays.asList(new UnaryFromClause(new GroupSymbol("a"))));
query.setSelect(select);
query.setFrom(from);
SetQuery setQuery = new SetQuery(Operation.UNION, true, query, query);
setQuery.setLimit(new Limit(new Reference(0), new Reference(1)));
// $NON-NLS-1$ //$NON-NLS-2$
helpTest("Select * from a union all Select * from a limit ?,?", "SELECT * FROM a UNION ALL SELECT * FROM a LIMIT ?, ?", setQuery);
}
use of org.teiid.query.sql.lang.UnaryFromClause in project teiid by teiid.
the class TestLimitParsing method testLimit.
@Test
public void testLimit() {
Query query = new Query();
Select select = new Select(Arrays.asList(new MultipleElementSymbol()));
// $NON-NLS-1$
From from = new From(Arrays.asList(new UnaryFromClause(new GroupSymbol("a"))));
query.setSelect(select);
query.setFrom(from);
query.setLimit(new Limit(null, new Constant(new Integer(100))));
// $NON-NLS-1$ //$NON-NLS-2$
helpTest("Select * from a limit 100", "SELECT * FROM a LIMIT 100", query);
}
use of org.teiid.query.sql.lang.UnaryFromClause in project teiid by teiid.
the class TestLimitParsing method testOffset.
@Test
public void testOffset() {
Query query = new Query();
Select select = new Select(Arrays.asList(new MultipleElementSymbol()));
// $NON-NLS-1$
From from = new From(Arrays.asList(new UnaryFromClause(new GroupSymbol("a"))));
query.setSelect(select);
query.setFrom(from);
query.setLimit(new Limit(new Reference(0), null));
// $NON-NLS-1$ //$NON-NLS-2$
helpTest("Select * from a offset ? rows", "SELECT * FROM a OFFSET ? ROWS", query);
}
use of org.teiid.query.sql.lang.UnaryFromClause in project teiid by teiid.
the class TestLimitParsing method testLimitWithReferences1.
@Test
public void testLimitWithReferences1() {
Query query = new Query();
Select select = new Select(Arrays.asList(new MultipleElementSymbol()));
// $NON-NLS-1$
From from = new From(Arrays.asList(new UnaryFromClause(new GroupSymbol("a"))));
query.setSelect(select);
query.setFrom(from);
query.setLimit(new Limit(new Reference(0), new Constant(new Integer(100))));
// $NON-NLS-1$ //$NON-NLS-2$
helpTest("Select * from a limit ?,100", "SELECT * FROM a LIMIT ?, 100", query);
}
Aggregations