use of org.teiid.query.sql.symbol.Constant in project teiid by teiid.
the class TestDynamicCommand method testClone2.
public void testClone2() {
List symbols = new ArrayList();
// $NON-NLS-1$
ElementSymbol a1 = new ElementSymbol("a1");
a1.setType(DataTypeManager.DefaultDataClasses.STRING);
symbols.add(a1);
// $NON-NLS-1$
Expression sql = new Constant("SELECT * FROM g");
SetClauseList using = new SetClauseList();
using.addClause(a1, a1);
// $NON-NLS-1$
DynamicCommand sqlCmd = new DynamicCommand(sql, symbols, new GroupSymbol("#g"), using);
UnitTestUtil.helpTestEquivalence(0, sqlCmd, sqlCmd.clone());
}
use of org.teiid.query.sql.symbol.Constant in project teiid by teiid.
the class TestLimit method testGetOffset.
public void testGetOffset() {
Limit limit = new Limit(new Constant(new Integer(50)), new Constant(new Integer(100)));
assertEquals(new Constant(new Integer(50)), limit.getOffset());
// Idempotent
assertEquals(new Constant(new Integer(50)), limit.getOffset());
}
use of org.teiid.query.sql.symbol.Constant in project teiid by teiid.
the class TestLimit method testGetRowLimit.
public void testGetRowLimit() {
Limit limit = new Limit(new Constant(new Integer(10)), new Constant(new Integer(30)));
assertEquals(new Constant(new Integer(30)), limit.getRowLimit());
assertEquals(new Constant(new Integer(30)), limit.getRowLimit());
}
use of org.teiid.query.sql.symbol.Constant in project teiid by teiid.
the class TestLimit method testToString.
public void testToString() {
// $NON-NLS-1$
assertEquals("LIMIT 50", new Limit(null, new Constant(new Integer(50))).toString());
// $NON-NLS-1$
assertEquals("LIMIT 100, 50", new Limit(new Constant(new Integer(100)), new Constant(new Integer(50))).toString());
// $NON-NLS-1$
assertEquals("LIMIT ?, ?", new Limit(new Reference(0), new Reference(1)).toString());
// $NON-NLS-1$
assertEquals("LIMIT -1, ?", new Limit(new Constant(new Integer(-1)), new Reference(1)).toString());
}
use of org.teiid.query.sql.symbol.Constant in project teiid by teiid.
the class TestLimit method testEquals.
public void testEquals() {
Limit limit1 = new Limit(new Constant(new Integer(100)), new Constant(new Integer(50)));
Limit limit2 = new Limit(new Constant(new Integer(100)), new Constant(new Integer(50)));
Limit limit3 = new Limit(new Constant(new Integer(99)), new Constant(new Integer(50)));
Limit limit4 = new Limit(new Constant(new Integer(100)), new Constant(new Integer(49)));
Limit limit5 = new Limit(null, new Constant(new Integer(50)));
Limit limit6 = new Limit(new Constant(new Integer(0)), new Constant(new Integer(50)));
Limit limit7 = new Limit(new Reference(0), new Constant(new Integer(50)));
Limit limit8 = new Limit(new Reference(0), new Reference(1));
Limit limit9 = new Limit(null, new Reference(1));
assertTrue(limit1.equals(limit2));
assertTrue(limit2.equals(limit1));
assertTrue(limit1.equals(limit1));
assertFalse(limit1.equals(null));
assertFalse(limit1.equals(limit3));
assertFalse(limit1.equals(limit4));
assertFalse(limit6.equals(limit7));
assertFalse(limit7.equals(limit6));
assertFalse(limit5.equals(limit7));
assertFalse(limit7.equals(limit5));
assertFalse(limit7.equals(limit8));
assertFalse(limit8.equals(limit9));
assertFalse(limit5.equals(limit9));
}
Aggregations