// SQLExpression numExpr = (SQLExpression)args.get(1);
// TODO Use numExpr in a SUBSTRING
if (substrExpr.isParameter())
{
// Any pattern expression cannot be a parameter here
SQLLiteral substrLit = (SQLLiteral)substrExpr;
stmt.getQueryGenerator().useParameterExpressionAsLiteral(substrLit);
if (substrLit.getValue() == null)
{
return new BooleanExpression(expr, Expression.OP_LIKE,
ExpressionUtils.getEscapedPatternExpression(substrExpr));
}
}
SQLExpression likeSubstrExpr = new StringLiteral(stmt,
expr.getJavaTypeMapping(), '%', null);
return new BooleanExpression(expr, Expression.OP_LIKE,
likeSubstrExpr.add(ExpressionUtils.getEscapedPatternExpression(substrExpr)));
}
else
{
// Create a new StringExpression and manually update its SQL
if (substrExpr.isParameter())
{
// Any pattern expression cannot be a parameter here
SQLLiteral substrLit = (SQLLiteral)substrExpr;
stmt.getQueryGenerator().useParameterExpressionAsLiteral(substrLit);
if (substrLit.getValue() == null)
{
return new BooleanExpression(expr, Expression.OP_LIKE,
ExpressionUtils.getEscapedPatternExpression(substrExpr));
}
}