// 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,
ExpressionUtils.getEscapedPatternExpression(substrExpr).add(likeSubstrExpr));
}
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));
}
}
SQLExpression likeSubstrExpr = new StringLiteral(stmt,
expr.getJavaTypeMapping(), '%', null);
return new BooleanExpression(expr, Expression.OP_LIKE,
ExpressionUtils.getEscapedPatternExpression(substrExpr).add(likeSubstrExpr));
}
}
}