use of org.teiid.language.Like in project teiid by teiid.
the class TestLikeCriteriaImpl method testGetRightExpression.
public void testGetRightExpression() throws Exception {
// $NON-NLS-1$
Like like = example("abc", '.', false);
assertNotNull(like.getRightExpression());
assertTrue(like.getRightExpression() instanceof Literal);
// $NON-NLS-1$
assertEquals("abc", ((Literal) like.getRightExpression()).getValue());
}
use of org.teiid.language.Like 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;
}
}
Aggregations