use of org.teiid.query.sql.symbol.GroupSymbol in project teiid by teiid.
the class TestLimitParsing method testLimitWithOffset.
@Test
public void testLimitWithOffset() {
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 Constant(new Integer(50)), new Constant(new Integer(100))));
// $NON-NLS-1$ //$NON-NLS-2$
helpTest("Select * from a limit 50,100", "SELECT * FROM a LIMIT 50, 100", query);
}
use of org.teiid.query.sql.symbol.GroupSymbol in project teiid by teiid.
the class TestLimitParsing method testLimitWithReferences2.
@Test
public void testLimitWithReferences2() {
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 Constant(new Integer(50)), new Reference(0)));
// $NON-NLS-1$ //$NON-NLS-2$
helpTest("Select * from a limit 50,?", "SELECT * FROM a LIMIT 50, ?", query);
}
use of org.teiid.query.sql.symbol.GroupSymbol in project teiid by teiid.
the class TestLimitParsing method testFetchFirstRow.
@Test
public void testFetchFirstRow() {
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(1)));
// $NON-NLS-1$ //$NON-NLS-2$
helpTest("Select * from a fetch first row only", "SELECT * FROM a LIMIT 1", query);
}
use of org.teiid.query.sql.symbol.GroupSymbol in project teiid by teiid.
the class TestLimitParsing method testOffsetFetch.
@Test
public void testOffsetFetch() {
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 Constant(2), new Constant(5)));
// $NON-NLS-1$ //$NON-NLS-2$
helpTest("Select * from a offset 2 rows fetch first 5 rows only", "SELECT * FROM a LIMIT 2, 5", query);
}
use of org.teiid.query.sql.symbol.GroupSymbol in project teiid by teiid.
the class TestOptionsAndHints method testOptionMakeNotDependent3.
/*+* Select a From db.g Option makenotdep a.b.c, d.e.f, x.y.z */
@Test
public void testOptionMakeNotDependent3() {
// $NON-NLS-1$
GroupSymbol g = new GroupSymbol("db.g");
From from = new From();
from.addGroup(g);
Select select = new Select();
// $NON-NLS-1$
ElementSymbol a = new ElementSymbol("a");
select.addSymbol(a);
Option option = new Option();
// $NON-NLS-1$
option.addNotDependentGroup("a.b.c");
// $NON-NLS-1$
option.addNotDependentGroup("d.e.f");
// $NON-NLS-1$
option.addNotDependentGroup("x.y.z");
Query query = new Query();
query.setSelect(select);
query.setFrom(from);
query.setOption(option);
// $NON-NLS-1$
TestParser.helpTest(// $NON-NLS-1$
"Select a From db.g Option makenotdep a.b.c, d.e.f, x.y.z", // $NON-NLS-1$
"SELECT a FROM db.g OPTION MAKENOTDEP a.b.c, d.e.f, x.y.z", query);
}
Aggregations