use of org.teiid.query.sql.symbol.ElementSymbol in project teiid by teiid.
the class TestInsertImpl method helpExample.
public static org.teiid.query.sql.lang.Insert helpExample(String groupName) {
GroupSymbol group = TestGroupImpl.helpExample(groupName);
ArrayList<ElementSymbol> elements = new ArrayList<ElementSymbol>();
// $NON-NLS-1$
elements.add(TestElementImpl.helpExample(groupName, "e1"));
// $NON-NLS-1$
elements.add(TestElementImpl.helpExample(groupName, "e2"));
// $NON-NLS-1$
elements.add(TestElementImpl.helpExample(groupName, "e3"));
// $NON-NLS-1$
elements.add(TestElementImpl.helpExample(groupName, "e4"));
ArrayList<Constant> values = new ArrayList<Constant>();
values.add(TestLiteralImpl.helpExample(1));
values.add(TestLiteralImpl.helpExample(2));
values.add(TestLiteralImpl.helpExample(3));
values.add(TestLiteralImpl.helpExample(4));
return new org.teiid.query.sql.lang.Insert(group, elements, values);
}
use of org.teiid.query.sql.symbol.ElementSymbol in project teiid by teiid.
the class TestInsertImpl method helpExample2.
public static org.teiid.query.sql.lang.Insert helpExample2(String groupName) {
GroupSymbol group = TestGroupImpl.helpExample(groupName);
ArrayList<ElementSymbol> elements = new ArrayList<ElementSymbol>();
// $NON-NLS-1$
elements.add(TestElementImpl.helpExample(groupName, "e1"));
ArrayList<org.teiid.query.sql.symbol.Expression> values = new ArrayList<org.teiid.query.sql.symbol.Expression>();
values.add(TestSearchedCaseExpressionImpl.helpExample());
return new org.teiid.query.sql.lang.Insert(group, elements, values);
}
use of org.teiid.query.sql.symbol.ElementSymbol in project teiid by teiid.
the class TestLikeCriteriaImpl method helpExample.
public static MatchCriteria helpExample(String right, char escape, boolean negated) {
// $NON-NLS-1$ //$NON-NLS-2$
ElementSymbol e1 = TestElementImpl.helpExample("vm1.g1", "e1");
MatchCriteria match = new MatchCriteria(e1, new Constant(right), escape);
match.setNegated(negated);
return match;
}
use of org.teiid.query.sql.symbol.ElementSymbol in project teiid by teiid.
the class TestSearchedCaseExpressionImpl method getWhenCriteria.
public static List getWhenCriteria(int criteria) {
ArrayList list = new ArrayList();
// $NON-NLS-1$ //$NON-NLS-2$
ElementSymbol x = TestElementImpl.helpExample("vm1.g1", "e1");
for (int i = 0; i < criteria; i++) {
list.add(new CompareCriteria(x, CompareCriteria.EQ, new Constant(new Integer(i))));
}
return list;
}
use of org.teiid.query.sql.symbol.ElementSymbol in project teiid by teiid.
the class ODataSQLBuilder method processOrderBy.
private OrderBy processOrderBy(OrderBy orderBy, List<OrderByItem> orderByItems, DocumentNode resource) throws TeiidException {
for (OrderByItem obitem : orderByItems) {
ODataExpressionToSQLVisitor visitor = new ODataExpressionToSQLVisitor(resource, false, getUriInfo(), this.metadata, this.odata, this.nameGenerator, this.params, this.parseService);
Expression expr = visitor.getExpression(obitem.getExpression());
if (expr instanceof ElementSymbol) {
orderBy.addVariable(expr, !obitem.isDescending());
} else {
AliasSymbol alias = new AliasSymbol("_orderByAlias", expr);
orderBy.addVariable(alias, !obitem.isDescending());
visitor.getEntityResource().addProjectedColumn(alias, EdmInt32.getInstance(), null, false);
}
}
return orderBy;
}
Aggregations