use of org.teiid.language.Expression in project teiid by teiid.
the class CoherenceVisitor method visit.
public void visit(Like obj) {
// $NON-NLS-1$
LogManager.logTrace(LogConstants.CTX_CONNECTOR, "Parsing LIKE criteria.");
// Convert LIKE to Equals, where any "%" symbol is replaced with "*".
try {
Comparison.Operator op = Operator.EQ;
Expression lhs = ((Like) obj).getLeftExpression();
Expression rhs = ((Like) obj).getRightExpression();
String lhsString = getExpressionString(lhs);
String rhsString = getExpressionString(rhs);
// rhsString = rhsString.replace("%", "*"); //$NON-NLS-1$ //$NON-NLS-2$
filter = CoherenceFilterUtil.createFilter(lhsString + " LIKE \'" + rhsString + "\'");
} catch (TranslatorException t) {
exception = t;
}
}
use of org.teiid.language.Expression in project teiid by teiid.
the class CoherenceVisitor method visit.
public void visit(In obj) {
// $NON-NLS-1$
LogManager.logTrace(LogConstants.CTX_CONNECTOR, "Parsing IN criteria.");
// isNegated = ((In) criteria).isNegated();
try {
Expression lhs = ((In) obj).getLeftExpression();
String lhsString = getExpressionString(lhs);
List<Expression> rhsList = ((In) obj).getRightExpressions();
Class type = null;
List parms = new ArrayList(rhsList.size());
Iterator iter = rhsList.iterator();
while (iter.hasNext()) {
Expression expr = (Expression) iter.next();
type = addParmFromExpression(expr, parms);
}
addInCriteria(lhsString, parms, type);
// filter = CoherenceFilterUtil.createInFilter(lhsString, parms, type);
} catch (TranslatorException t) {
exception = t;
}
}
use of org.teiid.language.Expression in project teiid by teiid.
the class TickerCollectorVisitor method visit.
public void visit(Comparison obj) {
Expression expr = obj.getRightExpression();
addTickerFromExpression(expr);
}
use of org.teiid.language.Expression in project teiid by teiid.
the class YahooExecution method getNeededColumns.
/**
* @param select
* @return
* @throws TranslatorException
*/
static int[] getNeededColumns(List<DerivedColumn> select) throws TranslatorException {
int[] cols = new int[select.size()];
Iterator<DerivedColumn> iter = select.iterator();
for (int i = 0; iter.hasNext(); i++) {
DerivedColumn symbol = iter.next();
Expression expr = symbol.getExpression();
if (expr instanceof ColumnReference) {
Column element = ((ColumnReference) expr).getMetadataObject();
cols[i] = element.getPosition();
} else {
// $NON-NLS-1$
throw new TranslatorException(YahooPlugin.Util.getString("YahooExecution.Invalid_select_symbol", expr));
}
}
return cols;
}
use of org.teiid.language.Expression in project teiid by teiid.
the class TestInsertImpl method testExpressionsInInsert.
public void testExpressionsInInsert() throws Exception {
// $NON-NLS-1$
Insert insert = example2("a.b");
assertNotNull(insert.getColumns());
assertEquals(1, insert.getColumns().size());
for (Iterator i = insert.getColumns().iterator(); i.hasNext(); ) {
assertTrue(i.next() instanceof ColumnReference);
}
assertNotNull(insert.getValueSource());
assertEquals(1, ((ExpressionValueSource) insert.getValueSource()).getValues().size());
for (Iterator i = ((ExpressionValueSource) insert.getValueSource()).getValues().iterator(); i.hasNext(); ) {
assertTrue(i.next() instanceof Expression);
}
}
Aggregations