@@ -736,50 +736,4 @@ public class QueryMapper {
|
||||
return this.property.getTypeInformation();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Models the ANSI SQL {@code UPPER} function.
|
||||
* <p>
|
||||
* Results in a rendered function: {@code UPPER(<expression>)}.
|
||||
*/
|
||||
private class Upper implements Expression {
|
||||
private Literal<Object> delegate;
|
||||
|
||||
/**
|
||||
* Creates new instance of this class with the given expression. Only expressions of type {@link Column} and
|
||||
* {@link org.springframework.data.relational.core.sql.BindMarker} are supported.
|
||||
*
|
||||
* @param expression expression to be uppercased (must not be {@literal null})
|
||||
*/
|
||||
private Upper(Expression expression) {
|
||||
Assert.notNull(expression, "Expression must not be null!");
|
||||
String functionArgument;
|
||||
if (expression instanceof org.springframework.data.relational.core.sql.BindMarker) {
|
||||
functionArgument = expression instanceof Named ? ((Named) expression).getName().getReference()
|
||||
: expression.toString();
|
||||
} else if (expression instanceof Column) {
|
||||
functionArgument = "";
|
||||
Table table = ((Column) expression).getTable();
|
||||
if (table != null) {
|
||||
functionArgument = toSql(table.getName()) + ".";
|
||||
}
|
||||
functionArgument += toSql(((Column) expression).getName());
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unable to ignore case expression of type " + expression.getClass().getName()
|
||||
+ ". Only " + Column.class.getName() + " and "
|
||||
+ org.springframework.data.relational.core.sql.BindMarker.class.getName() + " types are supported");
|
||||
}
|
||||
this.delegate = SQL.literalOf((Object) ("UPPER(" + functionArgument + ")"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(Visitor visitor) {
|
||||
delegate.visit(visitor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return delegate.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user